From e399173f7e5e02715d2bd98de318e276158987eb Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Sun, 27 Apr 2014 15:59:15 +0200 Subject: [PATCH] add a test that would fail with the restricted whitelist approach If no option is set, valid genres should not be rejected. Which is an argument to have a wide default whitelist. --- test/test_lastgenre.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/test_lastgenre.py b/test/test_lastgenre.py index 84580a47d..b4fa9cc4d 100644 --- a/test/test_lastgenre.py +++ b/test/test_lastgenre.py @@ -36,19 +36,19 @@ class LastGenrePluginTest(unittest.TestCase): if whitelist: lastGenrePlugin.whitelist = whitelist - def test_c14n(self): - """Resolve genres that belong to a canonicalization branch. + def test_defaults(self): + """Tests whitelist and c14n options with default filepaths """ # default whitelist and c14n - self._setup_config(canonical=' ') + self._setup_config(canonical='') self.assertEqual(lastGenrePlugin._resolve_genres(['delta blues']), 'Blues') self.assertEqual(lastGenrePlugin._resolve_genres(['iota blues']), '') - # custom whitelist - self._setup_config(canonical='', whitelist=set(['rock'])) + # default whitelist and no c14n + self._setup_config() self.assertEqual(lastGenrePlugin._resolve_genres(['delta blues']), - '') + 'delta blues') def test_whitelist(self): """Keep only genres that are in the whitelist. @@ -58,6 +58,10 @@ class LastGenrePluginTest(unittest.TestCase): self.assertEqual(lastGenrePlugin._resolve_genres(['pop', 'blues']), 'Blues') + self._setup_config(canonical='', whitelist=set(['rock'])) + self.assertEqual(lastGenrePlugin._resolve_genres(['delta blues']), + '') + def test_count(self): """Keep the n first genres, as we expect them to be sorted from more to less popular.