valid_payload = {'title': '', 'description': '', 'is_active': False}
self.check_post(valid_payload, '/condition?id=foo', 400)
- def test_do_POST_condition(self) -> None:
+ def test_POST_condition(self) -> None:
"""Test (valid) POST /condition and its effect on GET /condition[s]."""
# test valid POST's effect on …
post = {'title': 'foo', 'description': 'oof', 'is_active': False}
expected_all['_library'] = {}
self.check_json_get('/conditions', expected_all)
- def test_do_GET_condition(self) -> None:
+ def test_GET_condition(self) -> None:
"""More GET /condition testing, especially for Process relations."""
# check expected default status codes
self.check_get_defaults('/condition')
expected['_library']['Process'] = self.as_refs([proc1, proc2])
self.check_json_get('/condition?id=1', expected)
- def test_do_GET_conditions(self) -> None:
+ def test_GET_conditions(self) -> None:
"""Test GET /conditions."""
# test empty result on empty DB, default-settings on empty params
expected = self.GET_conditions_dict([])
# test other sortings
# (NB: by .is_active has two items of =False, their order currently
# is not explicitly made predictable, so mail fail until we do)
- expected['conditions'] = self.as_id_list([cond1, cond3, cond2])
expected['sort_by'] = '-title'
+ expected['conditions'] = self.as_id_list([cond1, cond3, cond2])
self.check_json_get('/conditions?sort_by=-title', expected)
- expected['conditions'] = self.as_id_list([cond1, cond2, cond3])
expected['sort_by'] = 'is_active'
+ expected['conditions'] = self.as_id_list([cond1, cond2, cond3])
self.check_json_get('/conditions?sort_by=is_active', expected)
- expected['conditions'] = self.as_id_list([cond3, cond1, cond2])
expected['sort_by'] = '-is_active'
+ expected['conditions'] = self.as_id_list([cond3, cond1, cond2])
self.check_json_get('/conditions?sort_by=-is_active', expected)
# test pattern matching on title
expected = self.GET_conditions_dict([cond2, cond3])
assert isinstance(expected['_library'], dict)
expected['conditions'] = self.as_id_list([cond1])
expected['_library']['Condition'] = self.as_refs([cond1])
- expected['pattern'] = 'oo'
- self.check_json_get('/conditions?pattern=oo', expected)
+ expected['pattern'] = 'of'
+ self.check_json_get('/conditions?pattern=of', expected)