Skip to content

Commit

Permalink
Added UT to test_tagger
Browse files Browse the repository at this point in the history
  • Loading branch information
westscz committed Apr 9, 2018
1 parent ef7f5a9 commit de80af8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class TestTagger(unittest.TestCase):
def setUp(self):
self.t = Tagger()
self.tags_list = ['foo','bar', 'foobar']

@mock.patch("musicbrainzngs.search_artists")
def test_get_tags_from_musicbrainzgs__match(self, search_artist_patch):
Expand All @@ -26,6 +27,34 @@ def test_get_tags_from_musicbrainzgs__empty(self, search_artist_patch):
result = self.t.get_tags_from_musicbrainzgs('foo')
self.assertListEqual([], result)

def test_filter_tags_with_whitelist(self):
self.t.whitelist = ['foo']
result = self.t.filter_tags_with_whitelist(self.tags_list)
self.assertListEqual(['foo'], result)

def test_filter_tags_with_blacklist(self):
self.t.blacklist = ['bar']
result = self.t.filter_tags_with_blacklist(self.tags_list)
self.assertListEqual(['foo', 'foobar'], result)

def test_filter_tags__whitelist(self):
self.t.whitelist = ['foo']
self.t.blacklist = None
result = self.t.filter_tags(self.tags_list)
self.assertListEqual(['foo'], result)

def test_filter_tags__blacklist(self):
self.t.whitelist = None
self.t.blacklist = ['bar']
result = self.t.filter_tags(self.tags_list)
self.assertListEqual(['foo', 'foobar'], result)

def test_filter_tags__all(self):
self.t.whitelist = ['foo', 'foobar']
self.t.blacklist = ['foo']
result = self.t.filter_tags(self.tags_list)
self.assertListEqual(['foobar'], result)


if __name__ == '__main__':
unittest.main()

0 comments on commit de80af8

Please sign in to comment.