home · contact · privacy
Slightly improve and re-organize Condition tests.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 22 Jun 2024 02:53:16 +0000 (04:53 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 22 Jun 2024 02:53:16 +0000 (04:53 +0200)
tests/conditions.py

index bf04f7b674b84ab2dcad9ebe349400809d449187..9b3a40383ad21d959ce8884fd5c180039d317919 100644 (file)
@@ -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)