valid_payload = {'title': '', 'description': '', 'is_active': False}
self.check_post(valid_payload, '/condition?id=foo', 400)
valid_payload = {'title': '', 'description': '', 'is_active': False}
self.check_post(valid_payload, '/condition?id=foo', 400)
"""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}
"""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)
expected_all['_library'] = {}
self.check_json_get('/conditions', expected_all)
"""More GET /condition testing, especially for Process relations."""
# check expected default status codes
self.check_get_defaults('/condition')
"""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)
expected['_library']['Process'] = self.as_refs([proc1, proc2])
self.check_json_get('/condition?id=1', expected)
"""Test GET /conditions."""
# test empty result on empty DB, default-settings on empty params
expected = self.GET_conditions_dict([])
"""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)
# 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)
self.check_json_get('/conditions?sort_by=-is_active', expected)
# test pattern matching on title
expected = self.GET_conditions_dict([cond2, cond3])
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])
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)