Esempio n. 1
0
 def test_main_interface_falls_back_to_amazon(self):
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = {'asin': 'xxxx'}
     artpath = art.art_for_album(album, self.dpath)
     self.assertEqual(artpath, 'anotherpath')
Esempio n. 2
0
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = {'asin': None}
     artpath = art.art_for_album(album, None)
     self.assertEqual(artpath, None)
Esempio n. 3
0
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = {'asin': 'xxxx'}
     artpath = art.art_for_album(album, self.dpath)
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
Esempio n. 4
0
 def test_main_interface_returns_amazon_art(self):
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     artpath = art.art_for_album(album, None)
     self.assertEqual(artpath, 'anotherpath')
Esempio n. 5
0
 def test_main_interface_returns_amazon_art(self):
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = {'asin': 'xxxx'}
     artpath = art.art_for_album(album, None)
     self.assertEqual(artpath, 'anotherpath')
Esempio n. 6
0
 def test_main_interface_tries_amazon_before_aao(self):
     self.urlopen_called = False
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     art.art_for_album(album, self.dpath)
     self.assertFalse(self.urlopen_called)
Esempio n. 7
0
 def test_main_interface_falls_back_to_aao(self):
     self.urlopen_called = False
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'text/html')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     art.art_for_album(album, self.dpath)
     self.assertTrue(self.urlopen_called)
Esempio n. 8
0
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = AlbumInfo(None, None, None, None, None, asin=None)
     artpath = art.art_for_album(album, None)
     self.assertEqual(artpath, None)
Esempio n. 9
0
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     artpath = art.art_for_album(album, self.dpath)
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
Esempio n. 10
0
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = AlbumInfo(None, None, None, None, None, asin=None)
     artpath = art.art_for_album(album, None)
     self.assertEqual(artpath, None)
Esempio n. 11
0
 def test_main_interface_falls_back_to_aao(self):
     self.urlopen_called = False
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'text/html')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     art.art_for_album(album, self.dpath)
     self.assertTrue(self.urlopen_called)
Esempio n. 12
0
 def test_main_interface_tries_amazon_before_aao(self):
     self.urlopen_called = False
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     art.art_for_album(album, self.dpath)
     self.assertFalse(self.urlopen_called)
Esempio n. 13
0
 def test_main_interface_returns_none_for_missing_asin(self):
     album = {'asin': None}
     artpath = art.art_for_album(album)
     self.assertEqual(artpath, None)
Esempio n. 14
0
 def test_main_interface_returns_amazon_art(self):
     art.urllib.urlretrieve = MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = {'asin': 'xxxx'}
     artpath = art.art_for_album(album)
     self.assertEqual(artpath, 'anotherpath')