Example #1
0
    def test_schema_load_failure_bad_file(self):
        """ Test Exception raise on not existent file load. """
        schemaproc = val.SchemaProcessor()

        schema = os.path.join('not', 'a', 'valid', 'path.json')
        nose.tools.assert_raises(jsonschema.SchemaError, schemaproc.load,
                                 schema)
Example #2
0
    def test_schema_load_failure_bad_file(self):
        """Test Exception raise on not existent file load."""
        schemaproc = val.SchemaProcessor()

        schema = os.path.join("not", "a", "valid", "path.json")
        with pytest.raises(jsonschema.SchemaError):
            schemaproc.load(schema)
Example #3
0
    def test_schema_load_failure_no_json_object(self):
        test_file_path = '/tmp/test.json'
        open(test_file_path, 'w').close()

        schemaproc = val.SchemaProcessor()

        nose.tools.assert_raises(jsonschema.SchemaError, schemaproc.load,
                                 test_file_path)

        os.remove(test_file_path)
Example #4
0
    def test_schema_load_failure_no_json_object(self):
        test_file_path = "/tmp/test.json"
        open(test_file_path, "w").close()

        schemaproc = val.SchemaProcessor()

        with pytest.raises(jsonschema.SchemaError):
            schemaproc.load(test_file_path)

        os.remove(test_file_path)
Example #5
0
    def test_schema_load(self):
        """ Test variable settings from proper schema loading. """
        schemaproc = val.SchemaProcessor()

        # Test success
        schema = os.path.join(DATA_PATH, "testSchemaLoad1.json")
        schemaproc.load(schema)
        assert schemaproc.data is not None
        assert isinstance(schemaproc.data, dict)
        assert schemaproc.loaded
        assert schemaproc.schemafile == schemaproc._schemafile