Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Aug 23, 2016
1 parent b61f915 commit 2002a88
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TestWebImage(TimeControlCase):
def setUp(self):
super(TestWebImage,self).setUp()
httpretty.enable()
self.image_content = open("tingbot/broken_image.png",'r').read()
self.image_content = open("tingbot/resources/broken_image.png",'r').read()

def tearDown(self):
httpretty.disable()
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_is_fresh_if_no_last_modified_or_etag(self):

class TestFileImage(unittest.TestCase):
def test_basic_load(self):
f = cache.FileImage('tingbot/broken_image.png')
f = cache.FileImage('tingbot/resources/broken_image.png')

def test_bad_location(self):
with self.assertRaises(IOError):
Expand All @@ -156,21 +156,21 @@ def test_bad_location(self):
@mock.patch('tingbot.cache.os.path.getmtime')
def test_is_fresh_if_unchanged_mod_time(self,mtime):
mtime.return_value = 200
f = cache.FileImage('tingbot/broken_image.png')
f = cache.FileImage('tingbot/resources/broken_image.png')
self.assertTrue(f.is_fresh())

@mock.patch('tingbot.cache.os.path.getmtime')
def test_is_fresh_if_changed_mod_time(self,mtime):
mtime.return_value = 200
f = cache.FileImage('tingbot/broken_image.png')
f = cache.FileImage('tingbot/resources/broken_image.png')
mtime.return_value = 300
self.assertFalse(f.is_fresh())

class TestImageCache(TimeControlCase):
def setUp(self):
super(TestImageCache,self).setUp()
httpretty.enable()
self.image_content = open("tingbot/broken_image.png",'r').read()
self.image_content = open("tingbot/resources/broken_image.png",'r').read()
self.tiny_content = open("tests/blank.png",'r').read()
httpretty.register_uri(httpretty.GET,re.compile("http://example.com/..png"), body=self.image_content)
httpretty.register_uri(httpretty.GET,re.compile("http://example.com/tiny/..png"), body=self.tiny_content)
Expand Down

0 comments on commit 2002a88

Please sign in to comment.