def testGoodLsbReleaseFile(self): path = os.path.join(self.parser_test_dir, "lsb-release") with open(path) as f: data = f.read() parser = linux_release_parser.LsbReleaseParseHandler(data) complete, result = parser.Parse() self.assertTrue(complete) self.assertTupleEqual(("Ubuntu", 14, 4), result)
def testFallbackLsbReleaseFile(self): path = os.path.join(self.parser_test_dir, "lsb-release-notubuntu") with open(path) as f: data = f.read() parser = linux_release_parser.LsbReleaseParseHandler(data) complete, result = parser.Parse() self.assertFalse(complete) self.assertTupleEqual(("NotUbuntu", 0, 0), result)
def testMalformedLsbReleaseFile(self): path = os.path.join(self.parser_test_dir, "lsb-release-bad") with open(path) as f: data = f.read() parser = linux_release_parser.LsbReleaseParseHandler(data) complete, result = parser.Parse() self.assertFalse(complete) self.assertTupleEqual((None, 0, 0), result)