From ca4f96e33c0f13e1a17edfc96e94293d78ed8144 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 10 Jun 2017 20:26:41 -0400 Subject: [PATCH] Consolidate export tests into MoveTest Just one new flag. --- test/test_ui.py | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/test/test_ui.py b/test/test_ui.py index ed31570e4..04c033f51 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -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)