DefaultValidator doesn't raise exceptions when validation fails
Bug #1165175 reported by
Max Brustkern
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
UTAH |
Fix Released
|
Medium
|
Javier Collado |
Bug Description
DefaultValidator will validate an empty dict as a valid control file without raising an exception:
>>> from jsonschema import Validator
>>> from utah.client.common import DefaultValidator
>>> from utah.client.
>>> schema = TestCase('', '/usr/share/
>>> DefaultValidato
>>> Validator(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
raise error
jsonschema.
>>>
Related branches
lp:~javier.collado/utah/bug1165175
- Andy Doan (community): Approve
- Javier Collado (community): Needs Resubmitting
-
Diff: 1264 lines (+693/-209)19 files modifieddebian/changelog (+1/-0)
debian/control (+3/-3)
docs/source/development.rst (+16/-14)
utah/client/common.py (+23/-9)
utah/client/examples/examples/tslist.run (+3/-3)
utah/client/examples/master.run (+0/-4)
utah/client/examples/pass.run (+0/-4)
utah/client/examples/utah_tests/tslist.run (+1/-1)
utah/client/examples/utah_tests_sample/tslist.run (+2/-1)
utah/client/exceptions.py (+0/-7)
utah/client/result.py (+1/-6)
utah/client/runner.py (+60/-79)
utah/client/testcase.py (+19/-34)
utah/client/tests/common.py (+0/-4)
utah/client/tests/test_jsonschema.py (+1/-16)
utah/client/tests/test_runner.py (+235/-1)
utah/client/tests/test_testcase.py (+167/-17)
utah/client/tests/test_testsuite.py (+135/-1)
utah/client/testsuite.py (+26/-5)
Changed in utah: | |
assignee: | nobody → Javier Collado (javier.collado) |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in utah: | |
status: | Triaged → In Progress |
Changed in utah: | |
status: | In Progress → Fix Committed |
Changed in utah: | |
milestone: | none → 0.12 |
Changed in utah: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I think we should have probably at least three tests for the DefaultValidator:
test that it validates valid data
test that it fails to validate bad data
test that it populates a default if needed
and maybe
test that not supplying a value with a default doesn't cause validation to fail?
Additionally, in test_testcase, I think we should test for:
missing field
extra field
bad reboot
bad timeout
bad type