mirror of
https://github.com/beetbox/beets.git
synced 2025-12-09 18:12:19 +01:00
Merge pull request #1614 from pkess/test_command_fields
added testcase for fields command
This commit is contained in:
commit
35497ff696
1 changed files with 29 additions and 0 deletions
|
|
@ -84,6 +84,35 @@ class QueryTest(_common.TestCase):
|
|||
self.check_do_query(0, 2, album=True, also_items=False)
|
||||
|
||||
|
||||
class FieldsTest(_common.LibTestCase):
|
||||
def setUp(self):
|
||||
super(FieldsTest, self).setUp()
|
||||
|
||||
self.io.install()
|
||||
|
||||
def tearDown(self):
|
||||
self.io.restore()
|
||||
|
||||
def remove_keys(self, l, text):
|
||||
for i in text:
|
||||
try:
|
||||
l.remove(i)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def test_fields_func(self):
|
||||
commands.fields_func(self.lib, [], [])
|
||||
items = library.Item.all_keys()
|
||||
albums = library.Album.all_keys()
|
||||
|
||||
output = self.io.stdout.get().split()
|
||||
self.remove_keys(items, output)
|
||||
self.remove_keys(albums, output)
|
||||
|
||||
self.assertEqual(len(items), 0)
|
||||
self.assertEqual(len(albums), 0)
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue