mirror of
https://github.com/beetbox/beets.git
synced 2025-12-24 17:43:52 +01:00
Removed akward tests
This commit is contained in:
parent
81b8d44814
commit
432d6f4437
1 changed files with 0 additions and 74 deletions
|
|
@ -511,80 +511,6 @@ class ImportExistingTest(_common.TestCase, ImportHelper):
|
|||
self.importer.run()
|
||||
self.assertNotExists(self.import_media[0].path)
|
||||
|
||||
|
||||
# Utilities for invoking the apply_choices, manipulate_files, and finalize
|
||||
# coroutines.
|
||||
def _call_stages(session, items, choice_or_info,
|
||||
stages=[importer.apply_choices,
|
||||
importer.manipulate_files,
|
||||
importer.finalize],
|
||||
album=True, toppath=None):
|
||||
# Set up the import task.
|
||||
task = importer.ImportTask(None, None, items)
|
||||
task.is_album = True
|
||||
task.toppath = toppath
|
||||
if not album:
|
||||
task.item = items[0]
|
||||
if isinstance(choice_or_info, importer.action):
|
||||
task.set_choice(choice_or_info)
|
||||
else:
|
||||
mapping = dict(zip(items, choice_or_info.tracks))
|
||||
task.set_choice(AlbumMatch(0, choice_or_info, mapping, set(), set()))
|
||||
|
||||
# Call the coroutines.
|
||||
for stage in stages:
|
||||
coro = stage(session)
|
||||
coro.next()
|
||||
coro.send(task)
|
||||
|
||||
return task
|
||||
|
||||
class ImportApplyTest(_common.TestCase):
|
||||
def setUp(self):
|
||||
super(ImportApplyTest, self).setUp()
|
||||
|
||||
self.libdir = os.path.join(self.temp_dir, 'testlibdir')
|
||||
os.mkdir(self.libdir)
|
||||
self.libpath = os.path.join(self.temp_dir, 'testlib.blb')
|
||||
self.lib = library.Library(self.libpath, self.libdir)
|
||||
self.lib.path_formats = [
|
||||
('default', 'one'),
|
||||
('singleton:true', 'three'),
|
||||
('comp:true', 'two'),
|
||||
]
|
||||
self.session = _common.import_session(self.lib)
|
||||
|
||||
self.srcdir = os.path.join(self.temp_dir, 'testsrcdir')
|
||||
os.mkdir(self.srcdir)
|
||||
os.mkdir(os.path.join(self.srcdir, 'testalbum'))
|
||||
self.srcpath = os.path.join(self.srcdir, 'testalbum', 'srcfile.mp3')
|
||||
shutil.copy(os.path.join(_common.RSRC, 'full.mp3'), self.srcpath)
|
||||
self.i = library.Item.from_path(self.srcpath)
|
||||
self.i.comp = False
|
||||
self.lib.add(self.i)
|
||||
|
||||
trackinfo = TrackInfo('one', 'trackid', 'some artist',
|
||||
'artistid', 1)
|
||||
self.info = AlbumInfo(
|
||||
artist = 'some artist',
|
||||
album = 'some album',
|
||||
tracks = [trackinfo],
|
||||
va = False,
|
||||
album_id = 'albumid',
|
||||
artist_id = 'artistid',
|
||||
albumtype = 'soundtrack',
|
||||
)
|
||||
|
||||
def test_apply_sentinel(self):
|
||||
coro = importer.apply_choices(self.session)
|
||||
coro.next()
|
||||
coro.send(importer.ImportTask.done_sentinel('toppath'))
|
||||
# Just test no exception for now.
|
||||
|
||||
def test_apply_populates_old_paths(self):
|
||||
task = _call_stages(self.session, [self.i], self.info)
|
||||
self.assertEqual(task.old_paths, [self.srcpath])
|
||||
|
||||
class InferAlbumDataTest(_common.TestCase):
|
||||
def setUp(self):
|
||||
super(InferAlbumDataTest, self).setUp()
|
||||
|
|
|
|||
Loading…
Reference in a new issue