Merge lp:~ken-vandine/friends/fix_avatars_dir_tests into lp:friends

Proposed by Ken VanDine
Status: Merged
Merged at revision: 71
Proposed branch: lp:~ken-vandine/friends/fix_avatars_dir_tests
Merge into: lp:friends
Diff against target: 22 lines (+4/-1)
1 file modified
friends/tests/test_avatars.py (+4/-1)
To merge this branch: bzr merge lp:~ken-vandine/friends/fix_avatars_dir_tests
Reviewer Review Type Date Requested Status
Robert Bruce Park Approve
Review via email: mp+134367@code.launchpad.net

Description of the change

Added some makedirs to the avatars tests to create the CACHE_DIR now that
the logic to create the dir has moved to the import. The mock needs to deal
with it.

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'friends/tests/test_avatars.py'
2--- friends/tests/test_avatars.py 2012-11-06 15:05:06 +0000
3+++ friends/tests/test_avatars.py 2012-11-14 20:46:25 +0000
4@@ -75,6 +75,7 @@
5 # The file has not yet been downloaded because the directory does
6 # not yet exist. It is created on demand.
7 self.assertFalse(os.path.isdir(cache_dir))
8+ os.makedirs(cache_dir)
9 Avatar.get_image('http://example.com')
10 # Soup.Message() was called once. Get the mock and check it.
11 from friends.utils.http import Soup
12@@ -111,7 +112,9 @@
13 FakeSoupMessage('friends.tests.data', 'ubuntu.png'))
14 def test_cache_file_contains_image(self):
15 # The image is preserved in the cache file.
16- with mock.patch('friends.utils.avatar.CACHE_DIR', self._avatar_cache):
17+ with mock.patch('friends.utils.avatar.CACHE_DIR',
18+ self._avatar_cache) as cache_dir:
19+ os.makedirs(cache_dir)
20 path = Avatar.get_image('http://example.com')
21 # The image must have been downloaded at least once.
22 pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)

Subscribers

People subscribed via source and target branches

to all changes: