mirror of
https://github.com/beetbox/beets.git
synced 2026-02-25 08:45:01 +01:00
test_fetchart: Avoid duplicate code in future tests.
This commit is contained in:
parent
2ea77652a7
commit
0696f915e5
1 changed files with 7 additions and 4 deletions
|
|
@ -29,21 +29,24 @@ class FetchartCliTest(unittest.TestCase, TestHelper):
|
|||
self.config['fetchart']['cover_names'] = 'c\xc3\xb6ver.jpg'
|
||||
self.config['art_filename'] = 'mycover'
|
||||
self.album = self.add_album()
|
||||
self.cover_path = os.path.join(self.album.path, b'mycover.jpg')
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
|
||||
def check_cover_is_stored(self):
|
||||
self.assertEqual(self.album['artpath'], self.cover_path)
|
||||
with open(util.syspath(self.cover_path), 'r') as f:
|
||||
self.assertEqual(f.read(), 'IMAGE')
|
||||
|
||||
def test_set_art_from_folder(self):
|
||||
self.touch(b'c\xc3\xb6ver.jpg', dir=self.album.path, content='IMAGE')
|
||||
|
||||
self.run_command('fetchart')
|
||||
cover_path = os.path.join(self.album.path, b'mycover.jpg')
|
||||
|
||||
self.album.load()
|
||||
self.assertEqual(self.album['artpath'], cover_path)
|
||||
with open(util.syspath(cover_path), 'r') as f:
|
||||
self.assertEqual(f.read(), 'IMAGE')
|
||||
self.check_cover_is_stored()
|
||||
|
||||
def test_filesystem_does_not_pick_up_folder(self):
|
||||
os.makedirs(os.path.join(self.album.path, b'mycover.jpg'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue