def setUp(self): self.path = '/static/public/testrunner/test.jpg' self.file = 'test.jpg' self.dlink = DynamicLink( slug='api_unittest', file_path=self.path, timeout_hours = 10, max_clicks = 10, )
class DynamicLinkTestCase(unittest.TestCase): """Test the DynamicLink API""" def setUp(self): self.path = '/static/public/testrunner/test.jpg' self.file = 'test.jpg' self.dlink = DynamicLink( slug='api_unittest', file_path=self.path, timeout_hours = 10, max_clicks = 10, ) def test_dynamic_link_methodes(self): request = Obj() request.__dict__['META']={} request.META['HTTP_HOST']='www.testrunner.eu' link = '%s/%s/%s/%s/%s' % ('http://www.testrunner.eu', 'lg', 'serve/link', self.dlink.get_link_key(), self.file, ) self.assertEqual(link, self.dlink.get_link_url(request))