Skip to content

Commit

Permalink
missing tests for length_equality
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredodeza committed Jun 13, 2012
1 parent d9358c9 commit fcb2882
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions notario/tests/test_engine.py
Expand Up @@ -74,6 +74,24 @@ def test_validate_length_equality(self):

assert exc.value.args[0] == 'top level length did not match schema'

def test_validate_length_equality_less_items(self):
data = {'a': 1, 'b': 2, 'c':'c'}
schema = (('a', 1), ('b', 2))
with raises(SchemaError) as exc:
validator = engine.Validator(data, schema)
validator.validate()

assert exc.value.args[0] == 'top level has less items in schema than in data'

def test_validate_length_equality_returns(self):
data = {0:('a', 1)}
class _Schema(object):
__validator_leaf__ = True
schema = {0:_Schema()}
validator = engine.Validator({}, {})
result = validator.length_equality(data, schema, 0, [])
assert result is None

def test_validate_top_level_values(self):
data = {'a': 1, 'b': 2}
schema = (('a', 1), ('b', 1))
Expand Down

0 comments on commit fcb2882

Please sign in to comment.