Skip to content

Commit

Permalink
Merge pull request beetbox#1614 from pkess/test_command_fields
Browse files Browse the repository at this point in the history
added testcase for fields command
  • Loading branch information
sampsyo committed Sep 25, 2015
2 parents 59d7b96 + 59a1f8b commit 35497ff
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/test_ui_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,35 @@ def test_query_album(self):
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__)

Expand Down

0 comments on commit 35497ff

Please sign in to comment.