mirror of
https://github.com/beetbox/beets.git
synced 2025-12-10 02:22:25 +01:00
Consolidate export tests into MoveTest
Just one new flag.
This commit is contained in:
parent
730c84e5e5
commit
ca4f96e33c
1 changed files with 6 additions and 30 deletions
|
|
@ -421,8 +421,9 @@ class MoveTest(_common.TestCase):
|
|||
self.otherdir = os.path.join(self.temp_dir, b'testotherdir')
|
||||
|
||||
def _move(self, query=(), dest=None, copy=False, album=False,
|
||||
pretend=False):
|
||||
commands.move_items(self.lib, dest, query, copy, album, pretend)
|
||||
pretend=False, export=False):
|
||||
commands.move_items(self.lib, dest, query, copy, album, pretend,
|
||||
export=export)
|
||||
|
||||
def test_move_item(self):
|
||||
self._move()
|
||||
|
|
@ -476,45 +477,20 @@ class MoveTest(_common.TestCase):
|
|||
self.i.load()
|
||||
self.assertIn(b'srcfile', self.i.path)
|
||||
|
||||
|
||||
class ExportTest(_common.TestCase):
|
||||
def setUp(self):
|
||||
super(ExportTest, self).setUp()
|
||||
|
||||
self.libdir = os.path.join(self.temp_dir, b'testlibdir')
|
||||
os.mkdir(self.libdir)
|
||||
|
||||
self.itempath = os.path.join(self.libdir, b'srcfile')
|
||||
shutil.copy(os.path.join(_common.RSRC, b'full.mp3'), self.itempath)
|
||||
|
||||
# Add a file to the library but don't copy it in yet.
|
||||
self.lib = library.Library(':memory:', self.libdir)
|
||||
self.i = library.Item.from_path(self.itempath)
|
||||
self.lib.add(self.i)
|
||||
self.album = self.lib.add_album([self.i])
|
||||
|
||||
# Alternate destination directory.
|
||||
self.otherdir = os.path.join(self.temp_dir, b'testotherdir')
|
||||
|
||||
def _move(self, query=(), dest=None, copy=False, album=False,
|
||||
pretend=False, export=True):
|
||||
commands.move_items(self.lib, dest, query, copy, album,
|
||||
pretend, export=export)
|
||||
|
||||
def test_export_item_custom_dir(self):
|
||||
self._move(dest=self.otherdir)
|
||||
self._move(dest=self.otherdir, export=True)
|
||||
self.i.load()
|
||||
self.assertEqual(self.i.path, self.itempath)
|
||||
self.assertExists(self.otherdir)
|
||||
|
||||
def test_export_album_custom_dir(self):
|
||||
self._move(dest=self.otherdir, album=True)
|
||||
self._move(dest=self.otherdir, album=True, export=True)
|
||||
self.i.load()
|
||||
self.assertEqual(self.i.path, self.itempath)
|
||||
self.assertExists(self.otherdir)
|
||||
|
||||
def test_pretend_export_item(self):
|
||||
self._move(dest=self.otherdir, pretend=True)
|
||||
self._move(dest=self.otherdir, pretend=True, export=True)
|
||||
self.i.load()
|
||||
self.assertIn(b'srcfile', self.i.path)
|
||||
self.assertNotExists(self.otherdir)
|
||||
|
|
|
|||
Loading…
Reference in a new issue