From 0365a9599e3050256879f982d5edeade1d0f3a83 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Thu, 25 Jul 2013 16:17:47 +0200 Subject: [PATCH] [#1117] Add some asserts to ignore_missing tests --- ckan/new_tests/lib/navl/test_validators.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ckan/new_tests/lib/navl/test_validators.py b/ckan/new_tests/lib/navl/test_validators.py index 1d0f526b273..1e34b51face 100644 --- a/ckan/new_tests/lib/navl/test_validators.py +++ b/ckan/new_tests/lib/navl/test_validators.py @@ -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. @@ -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.''' @@ -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. @@ -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] == []