Example #1
0
def test_ensure_valid_schema_succeeds():
    spec_yaml = """
        fred:
            attributes:
                - flub

        mark:
        """
    spec = yaml.load(spec_yaml)
    errors = spec_inspector.ensure_valid_schema(spec)
    assert len(errors) == 0
Example #2
0
def test_ensure_valid_schema_fails():
    """ We could check more functionality, but at that point we'd just be testing cerberus. This
    test is just to verify that a failure will happen and will be presented as we'd expect """
    spec_yaml = """
        fred:
            attribute:
                - flub
        """
    spec = yaml.safe_load(spec_yaml)
    errors = spec_inspector.ensure_valid_schema(spec)
    expected = spec_inspector.VALIDATION_ERR_MSG.format('fred', 'attribute', 'unknown field')
    assert expected == errors[0]