PyUT: Implement test for lsb_release.parse_policy_line.
authorDidier Raboud <odyx@debian.org>
Mon, 21 May 2012 15:18:57 +0000 (17:18 +0200)
committerDidier Raboud <odyx@debian.org>
Mon, 21 May 2012 15:18:57 +0000 (17:18 +0200)
test/test_lsb_release.py

index 8a1dfb843f59a0df1c85c41c1430f7e1e37527c4..9c5f2c23cb6d1289b84bd2d5be522e6655eb3235 100644 (file)
@@ -60,9 +60,18 @@ class TestLSBRelease(unittest.TestCase):
        @unittest.skip('Test not implemented.')
        def test_check_modules_installed(self):
                raise NotImplementedError()
-       @unittest.skip('Test not implemented.')
+
        def test_parse_policy_line(self):
-               raise NotImplementedError()
+               release_line = ''
+               shortnames = lr.longnames.keys()
+               random.shuffle(shortnames)
+               longnames = {}
+               for shortname in shortnames:
+                       longnames[lr.longnames[shortname]] = ''.join( [random.choice(string.letters) for i in xrange(random.randint(1,9))])
+                       release_line += shortname + '=' + longnames[lr.longnames[shortname]] + ','
+               release_line = string.strip(release_line,',')
+               self.assertEqual(sorted(lr.parse_policy_line(release_line)),sorted(longnames),'parse_policy_line(' + release_line + ')')
+
        @unittest.skip('Test not implemented.')
        def test_compare_release(self):
                raise NotImplementedError()