Skip to content

Commit 35497ff

Browse files
committed
Merge pull request beetbox#1614 from pkess/test_command_fields
added testcase for fields command
2 parents 59d7b96 + 59a1f8b commit 35497ff

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test_ui_commands.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,35 @@ def test_query_album(self):
8484
self.check_do_query(0, 2, album=True, also_items=False)
8585

8686

87+
class FieldsTest(_common.LibTestCase):
88+
def setUp(self):
89+
super(FieldsTest, self).setUp()
90+
91+
self.io.install()
92+
93+
def tearDown(self):
94+
self.io.restore()
95+
96+
def remove_keys(self, l, text):
97+
for i in text:
98+
try:
99+
l.remove(i)
100+
except ValueError:
101+
pass
102+
103+
def test_fields_func(self):
104+
commands.fields_func(self.lib, [], [])
105+
items = library.Item.all_keys()
106+
albums = library.Album.all_keys()
107+
108+
output = self.io.stdout.get().split()
109+
self.remove_keys(items, output)
110+
self.remove_keys(albums, output)
111+
112+
self.assertEqual(len(items), 0)
113+
self.assertEqual(len(albums), 0)
114+
115+
87116
def suite():
88117
return unittest.TestLoader().loadTestsFromName(__name__)
89118

0 commit comments

Comments
 (0)