-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diff short code for http and non http fix, clickmeta test case, fixes
- Loading branch information
Showing
11 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
import tempfile | ||
from unittest import TestCase | ||
|
||
from pygmy.app.link import shorten, unshorten, link_stats | ||
from pygmy.core.initialize import initialize_test | ||
from pygmy.config import config | ||
|
||
|
||
class URLClickStatsTest(TestCase): | ||
"""Test for clickmeta i.e. click stats""" | ||
|
||
DBPath = None | ||
|
||
def setUp(self): | ||
self.long_url = 'https://example.com' | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
currdir = os.path.dirname(os.path.abspath(__file__)) | ||
config_path = currdir + '/pygmy_test.cfg' | ||
db_path = tempfile.NamedTemporaryFile(suffix='.db').name | ||
cls.DBPath = "sqlite:///{}".format(db_path) | ||
initialize_test(config_path, db_url=cls.DBPath) | ||
|
||
def test_config(self): | ||
assert config is not None | ||
assert config.db is not None | ||
assert self.DBPath is not None | ||
|
||
def test_clickmeta(self): | ||
data = shorten(self.long_url) | ||
assert isinstance(data, dict) is True | ||
assert link_stats(data['short_code'] + 'abc+') is None | ||
stats = link_stats(data['short_code'] + '+') | ||
assert stats is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters