home
·
contact
·
privacy
projects
/
plomtask
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7fe7962
)
Slightly improve and re-organize Condition tests.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 22 Jun 2024 02:53:16 +0000
(
04:53
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 22 Jun 2024 02:53:16 +0000
(
04:53
+0200)
tests/conditions.py
patch
|
blob
|
history
diff --git
a/tests/conditions.py
b/tests/conditions.py
index bf04f7b674b84ab2dcad9ebe349400809d449187..9b3a40383ad21d959ce8884fd5c180039d317919 100644
(file)
--- a/
tests/conditions.py
+++ b/
tests/conditions.py
@@
-77,7
+77,7
@@
class TestsWithServer(TestCaseWithServer):
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)
- 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}
"""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}
@@
-110,7
+110,7
@@
class TestsWithServer(TestCaseWithServer):
expected_all['_library'] = {}
self.check_json_get('/conditions', expected_all)
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')
"""More GET /condition testing, especially for Process relations."""
# check expected default status codes
self.check_get_defaults('/condition')
@@
-141,7
+141,7
@@
class TestsWithServer(TestCaseWithServer):
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)
- 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 GET /conditions."""
# test empty result on empty DB, default-settings on empty params
expected = self.GET_conditions_dict([])
@@
-167,14
+167,14
@@
class TestsWithServer(TestCaseWithServer):
# 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)
- expected['conditions'] = self.as_id_list([cond1, cond3, cond2])
expected['sort_by'] = '-title'
expected['sort_by'] = '-title'
+ expected['conditions'] = self.as_id_list([cond1, cond3, cond2])
self.check_json_get('/conditions?sort_by=-title', expected)
self.check_json_get('/conditions?sort_by=-title', expected)
- expected['conditions'] = self.as_id_list([cond1, cond2, cond3])
expected['sort_by'] = 'is_active'
expected['sort_by'] = 'is_active'
+ expected['conditions'] = self.as_id_list([cond1, cond2, cond3])
self.check_json_get('/conditions?sort_by=is_active', expected)
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['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])
self.check_json_get('/conditions?sort_by=-is_active', expected)
# test pattern matching on title
expected = self.GET_conditions_dict([cond2, cond3])
@@
-184,5
+184,5
@@
class TestsWithServer(TestCaseWithServer):
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'] = 'o
o
'
- self.check_json_get('/conditions?pattern=o
o
', expected)
+ expected['pattern'] = 'o
f
'
+ self.check_json_get('/conditions?pattern=o
f
', expected)