From: Christian Heller Date: Sat, 22 Jun 2024 02:53:16 +0000 (+0200) Subject: Slightly improve and re-organize Condition tests. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/all?a=commitdiff_plain;h=44812c864c635474d117d61a2ea56f8f10f743eb;p=plomtask Slightly improve and re-organize Condition tests. --- diff --git a/tests/conditions.py b/tests/conditions.py index bf04f7b..9b3a403 100644 --- 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) - 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} @@ -110,7 +110,7 @@ class TestsWithServer(TestCaseWithServer): 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') @@ -141,7 +141,7 @@ class TestsWithServer(TestCaseWithServer): 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([]) @@ -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) - 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]) @@ -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]) - expected['pattern'] = 'oo' - self.check_json_get('/conditions?pattern=oo', expected) + expected['pattern'] = 'of' + self.check_json_get('/conditions?pattern=of', expected)