Esempio n. 1
0
    def test_json_schema_with_missing_fields(self):
        build = load_builds(os.path.join(self.build_dir, "build.json")).pop()

        """
        Make sure that if a required field is missing an exception is thrown
        """
        for f in ALLOWED_METADATA:
            missing = {k: build[k] for k in build.keys() if k != f}
            with self.assertRaises(jsonschema.exceptions.ValidationError):
                jsonschema.validate([missing], TUXBUILD_SCHEMA)
Esempio n. 2
0
    def test_create_name_with_buildset(self):
        builds = load_builds(os.path.join(self.buildset_dir, "build.json"))

        tests = [
            "build/gcc-8-allnoconfig",
            "build/gcc-8-tinyconfig",
            "build/gcc-8-x86_64_defconfig",
        ]

        self.assertEqual([create_name(build) for build in builds], tests)
Esempio n. 3
0
    def test_create_metadata_with_buildset(self):
        builds = load_builds(os.path.join(self.buildset_dir, "build.json"))

        for build in builds:
            self.check_metadata(build)
Esempio n. 4
0
    def test_create_metadata_with_build(self):
        build = load_builds(os.path.join(self.build_dir, "build.json")).pop()

        self.check_metadata(build)
Esempio n. 5
0
 def test_create_name_with_build(self):
     build = load_builds(os.path.join(self.build_dir, "build.json")).pop()
     self.assertEqual(create_name(build), "build/gcc-11-lkftconfig")
Esempio n. 6
0
 def test_json_schema_with_buildset(self):
     builds = load_builds(os.path.join(self.buildset_dir, "build.json"))
     jsonschema.validate(builds, TUXBUILD_SCHEMA)
Esempio n. 7
0
 def test_load_builds_empty_json(self):
     with self.assertRaises(InvalidBuildJson):
         load_builds(os.path.join(self.root_dir, "empty.json"))
Esempio n. 8
0
 def test_load_builds_missing_json(self):
     with self.assertRaises(FileNotFoundError):
         load_builds(os.path.join(self.root_dir, "missing.json"))
Esempio n. 9
0
 def test_load_builds_with_buildset(self):
     builds = load_builds(os.path.join(self.buildset_dir, "build.json"))
     self.assertEqual(len(builds), 3)