コード例 #1
0
def test_get_legal_type():
    """Assert that the schema can be retrieved and that the enum has the right number of types."""
    current_types = 46
    schema = get_schema('business.json')
    legal_types = schema['definitions']['legalType']['enum']
    assert legal_types
    assert len(legal_types) == current_types
コード例 #2
0
def test_sanity():
    """Assert that the business schema can be retrieved.

    If this fails, nothing else will work.
    """
    schema = get_schema('business.json')
    print(schema)
    assert schema
コード例 #3
0
def test_is_business_schema_valid(schema_filename):
    """Assert that the Schema is a valid Draft7 JSONSchema."""
    schema = get_schema(schema_filename)
    try:
        Draft7Validator.check_schema(schema)
        assert True
    except SchemaError as error:
        print(error)
        assert False
コード例 #4
0
def test_legal_types():
    """Assert that all legalTypes validate in the schema."""
    schema = get_schema('business.json')
    legal_types = schema['definitions']['legalType']['enum']

    business = copy.deepcopy(BUSINESS)

    for t in legal_types:
        business['legalType'] = t
        print(t)
        assert validate(business, 'business')