Ejemplo 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')
Ejemplo 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)
Ejemplo 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'))
Ejemplo 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')
Ejemplo 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')
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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'))
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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')