Exemple #1
0
 def test_clickmeta(self):
     from pygmy.app.link import shorten, unshorten, link_stats
     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
 def test_custom_short_url(self):
     short_code = 'test'
     data = shorten(self.long_url, short_code=short_code)
     assert data['short_code'] == short_code
     assert data['is_custom'] is True
     udata = unshorten(short_url=short_code)
     assert udata['long_url'] == self.long_url
 def test_http_non_http_url(self):
     urls = [
         'http://example.com',
         'example.com'
     ]
     response = set(shorten(u)['short_code'] for u in urls)
     assert len(response) == 1
 def test_aaa_long_url_shorten(self):
     data = shorten(self.long_url)
     assert isinstance(data, dict) is True
     assert data['short_code'] == 'b'
     assert data['is_disabled'] is False
     assert data['is_protected'] is False
     assert data['is_custom'] is False
 def test_custom_short_url(self):
     from pygmy.app.link import shorten, unshorten
     short_code = 'test'
     data = shorten(self.long_url, short_code=short_code)
     assert data['short_code'] == short_code
     assert data['is_custom'] is True
     udata = unshorten(short_url=short_code)
     assert udata['long_url'] == self.long_url
 def test_aaa_long_url_shorten(self):
     from pygmy.app.link import shorten, unshorten
     data = shorten(self.long_url)
     assert isinstance(data, dict) is True
     assert data['short_code'] == 'b'
     assert data['is_disabled'] is False
     assert data['is_protected'] is False
     assert data['is_custom'] is False
 def test_secret_short_url(self):
     secret_key = 123
     data = shorten(self.long_url, secret_key=secret_key)
     assert data['is_protected'] is True
     assert data['secret_key'] == str(secret_key)
     with self.assertRaises(URLAuthFailed):
         unshorten(data['short_code'])
         unshorten(data['short_code'], secret_key='safe')
     udata = unshorten(data['short_code'], secret_key='123')
     assert udata['long_url'] == data['long_url']
 def test_short_url_unshorten(self):
     data = shorten(self.long_url)
     udata = unshorten(data['short_code'])
     assert isinstance(udata, dict)
     assert udata['long_url'] == self.long_url
Exemple #9
0
 def test_clickmeta(self):
     data = shorten(self.long_url)
     self.assertTrue(isinstance(data, dict) is True)
     self.assertIsNone(link_stats(data['short_code'] + 'abc+'))
     stats = link_stats(data['short_code'] + '+')
     self.assertIsNotNone(stats)
 def test_http_non_http_url(self):
     from pygmy.app.link import shorten, unshorten
     urls = ['http://example.com', 'example.com']
     response = set(shorten(u)['short_code'] for u in urls)
     assert len(response) == 1
 def test_short_url_unshorten(self):
     from pygmy.app.link import shorten, unshorten
     data = shorten(self.long_url)
     udata = unshorten(data['short_code'])
     assert isinstance(udata, dict)
     assert udata['long_url'] == self.long_url
Exemple #12
0
 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