コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    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)