Skip to content

Commit

Permalink
[#1117] Add some asserts to ignore_missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Jul 25, 2013
1 parent ca16b01 commit 0365a95
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ckan/new_tests/lib/navl/test_validators.py
Expand Up @@ -26,6 +26,9 @@ def test_ignore_missing_with_None(self):
# ignore_missing should remove the item from the dict.
assert key not in data

# ignore_missing should not add any errors.
assert errors[key] == []

def test_ignore_missing_with_missing(self):
'''If data[key] is missing ignore_missing() should raise StopOnError.
Expand All @@ -47,6 +50,9 @@ def test_ignore_missing_with_missing(self):
# ignore_missing should remove the item from the dict.
assert key not in data

# ignore_missing should not add any errors.
assert errors[key] == []

def test_ignore_missing_without_key(self):
'''If key is not in data ignore_missing() should raise StopOnError.'''

Expand All @@ -67,6 +73,9 @@ def test_ignore_missing_without_key(self):
# ignore_missing should remove the item from the dict.
assert key not in data

# ignore_missing should not add any errors.
assert errors[key] == []

def test_ignore_missing_with_a_value(self):
'''If data[key] is neither None or missing, ignore_missing() should do
nothing.
Expand All @@ -82,4 +91,9 @@ def test_ignore_missing_with_a_value(self):
context={})

assert result is None

# ignore_missing shouldn't remove or modify the value.
assert data.get(key) == 'bar'

# ignore_missing shouldn't add any errors.
assert errors[key] == []

0 comments on commit 0365a95

Please sign in to comment.