예제 #1
0
파일: test_art.py 프로젝트: msabramo/beets
 def test_main_interface_tries_amazon_before_aao(self):
     self.urlopen_called = False
     fetchart.urllib.urlretrieve = \
             MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     fetchart.art_for_album(album, self.dpath)
     self.assertFalse(self.urlopen_called)
예제 #2
0
파일: test_art.py 프로젝트: msabramo/beets
 def test_main_interface_falls_back_to_aao(self):
     self.urlopen_called = False
     fetchart.urllib.urlretrieve = \
             MockUrlRetrieve('anotherpath', 'text/html')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     fetchart.art_for_album(album, self.dpath)
     self.assertTrue(self.urlopen_called)
예제 #3
0
파일: test_art.py 프로젝트: msabramo/beets
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     fetchart.urllib.urlretrieve = \
             MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     artpath = fetchart.art_for_album(album, self.dpath)
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
예제 #4
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_uses_caa_when_mbid_available(self):
     self.mock_response(self.CAA_URL)
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
     self.assertEqual(len(responses.calls), 1)
     self.assertEqual(responses.calls[0].request.url, self.CAA_URL)
예제 #5
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_uses_caa_when_mbid_available(self):
     self.mock_response(self.CAA_URL)
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
     self.assertEqual(len(responses.calls), 1)
     self.assertEqual(responses.calls[0].request.url, self.CAA_URL)
예제 #6
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_uses_caa_when_mbid_available(self):
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
     self.assertTrue('coverartarchive.org' in mock_retrieve.fetched)
예제 #7
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_uses_caa_when_mbid_available(self):
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
     self.assertTrue('coverartarchive.org' in mock_retrieve.fetched)
예제 #8
0
파일: test_art.py 프로젝트: dreewoo/beets
 def test_local_only_gets_fs_image(self):
     _common.touch(os.path.join(self.dpath, 'art.jpg'))
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath],
                                      None, local_only=True)
     self.assertEqual(artpath, os.path.join(self.dpath, 'art.jpg'))
     self.assertEqual(len(responses.calls), 0)
예제 #9
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_local_only_does_not_access_network(self):
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, self.dpath, local_only=True)
     self.assertEqual(artpath, None)
     self.assertFalse(self.urlopen_called)
     self.assertFalse(mock_retrieve.fetched)
예제 #10
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_local_only_gets_fs_image(self):
     _common.touch(os.path.join(self.dpath, 'art.jpg'))
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath],
                                      None,
                                      local_only=True)
     self.assertEqual(artpath, os.path.join(self.dpath, 'art.jpg'))
     self.assertEqual(len(responses.calls), 0)
예제 #11
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_local_only_does_not_access_network(self):
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, [self.dpath], local_only=True)
     self.assertEqual(artpath, None)
     self.assertFalse(self.urlopen_called)
     self.assertFalse(mock_retrieve.fetched)
예제 #12
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_local_only_gets_fs_image(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, [self.dpath], local_only=True)
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
     self.assertFalse(self.urlopen_called)
     self.assertFalse(mock_retrieve.fetched)
예제 #13
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_local_only_gets_fs_image(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     mock_retrieve = MockUrlRetrieve('image/jpeg')
     fetchart.urllib.urlretrieve = mock_retrieve
     album = _common.Bag(mb_albumid='releaseid', asin='xxxx')
     artpath = fetchart.art_for_album(album, self.dpath, local_only=True)
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
     self.assertFalse(self.urlopen_called)
     self.assertFalse(mock_retrieve.fetched)
예제 #14
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_falls_back_to_aao(self):
     self.mock_response(self.AMAZON_URL, content_type='text/html')
     album = _common.Bag(asin=self.ASIN)
     fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(responses.calls[-1].request.url, self.AAO_URL)
예제 #15
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_tries_amazon_before_aao(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(len(responses.calls), 1)
     self.assertEqual(responses.calls[0].request.url, self.AMAZON_URL)
예제 #16
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_tries_amazon_before_aao(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     fetchart.art_for_album(album, self.dpath)
     self.assertFalse(self.urlopen_called)
예제 #17
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'art.jpg'))
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(artpath, os.path.join(self.dpath, 'art.jpg'))
예제 #18
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_falls_back_to_aao(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('text/html')
     album = _common.Bag(asin='xxxx')
     fetchart.art_for_album(album, [self.dpath])
     self.assertTrue(self.urlopen_called)
예제 #19
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_falls_back_to_amazon(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertNotEqual(artpath, None)
     self.assertFalse(artpath.startswith(self.dpath))
예제 #20
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_tries_amazon_before_aao(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(len(responses.calls), 1)
     self.assertEqual(responses.calls[0].request.url, self.AMAZON_URL)
예제 #21
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_returns_amazon_art(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
예제 #22
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_returns_amazon_art(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
예제 #23
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_local_only_does_not_access_network(self):
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath], local_only=True)
     self.assertEqual(artpath, None)
     self.assertEqual(len(responses.calls), 0)
예제 #24
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = _common.Bag()
     artpath = fetchart.art_for_album(album, None)
     self.assertEqual(artpath, None)
예제 #25
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_returns_amazon_art(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
예제 #26
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_falls_back_to_amazon(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, self.dpath)
     self.assertNotEqual(artpath, None)
     self.assertFalse(artpath.startswith(self.dpath))
예제 #27
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_falls_back_to_aao(self):
     self.mock_response(self.AMAZON_URL, content_type='text/html')
     album = _common.Bag(asin=self.ASIN)
     fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(responses.calls[-1].request.url, self.AAO_URL)
예제 #28
0
파일: test_art.py 프로젝트: msabramo/beets
 def test_main_interface_returns_amazon_art(self):
     fetchart.urllib.urlretrieve = \
             MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = AlbumInfo(None, None, None, None, None, asin='xxxx')
     artpath = fetchart.art_for_album(album, None)
     self.assertEqual(artpath, 'anotherpath')
예제 #29
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_local_only_does_not_access_network(self):
     album = _common.Bag(mb_albumid=self.MBID, asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath], local_only=True)
     self.assertEqual(artpath, None)
     self.assertEqual(len(responses.calls), 0)
예제 #30
0
파일: test_art.py 프로젝트: msabramo/beets
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = AlbumInfo(None, None, None, None, None, asin=None)
     artpath = fetchart.art_for_album(album, None)
     self.assertEqual(artpath, None)
예제 #31
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'a.jpg'))
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(artpath, os.path.join(self.dpath, 'a.jpg'))
예제 #32
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_returns_amazon_art(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, None)
     self.assertNotEqual(artpath, None)
예제 #33
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_tries_amazon_before_aao(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     fetchart.art_for_album(album, [self.dpath])
     self.assertFalse(self.urlopen_called)
예제 #34
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'art.jpg'))
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(artpath, os.path.join(self.dpath, 'art.jpg'))
예제 #35
0
파일: test_art.py 프로젝트: SUTJael/beets
 def test_main_interface_falls_back_to_amazon(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertNotEqual(artpath, None)
     self.assertFalse(artpath.startswith(self.dpath))
예제 #36
0
파일: test_art.py 프로젝트: zhang-xun/beets
 def test_main_interface_falls_back_to_amazon(self):
     self.mock_response(self.AMAZON_URL)
     album = _common.Bag(asin=self.ASIN)
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertNotEqual(artpath, None)
     self.assertFalse(artpath.startswith(self.dpath))
예제 #37
0
파일: test_art.py 프로젝트: Bitdemon/beets
 def test_main_interface_gives_precedence_to_fs_art(self):
     _common.touch(os.path.join(self.dpath, 'art.jpg'))
     fetchart.urllib.urlretrieve = MockUrlRetrieve('image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, [self.dpath])
     self.assertEqual(artpath, os.path.join(self.dpath, 'art.jpg'))
예제 #38
0
파일: test_art.py 프로젝트: Rawrpwnzl/beets
 def test_main_interface_falls_back_to_aao(self):
     fetchart.urllib.urlretrieve = MockUrlRetrieve('text/html')
     album = _common.Bag(asin='xxxx')
     fetchart.art_for_album(album, self.dpath)
     self.assertTrue(self.urlopen_called)
예제 #39
0
파일: test_art.py 프로젝트: Lugoues/beets
 def test_main_interface_returns_none_for_missing_asin_and_path(self):
     album = _common.Bag()
     artpath = fetchart.art_for_album(album, None)
     self.assertEqual(artpath, None)
예제 #40
0
 def test_main_interface_falls_back_to_amazon(self):
     fetchart.urllib.urlretrieve = \
             MockUrlRetrieve('anotherpath', 'image/jpeg')
     album = _common.Bag(asin='xxxx')
     artpath = fetchart.art_for_album(album, self.dpath)
     self.assertEqual(artpath, 'anotherpath')