home · contact · privacy
Refactor request handler identifying items by ID param on GET.
[plomtask] / tests / conditions.py
index 8f86854f16f0c47aa676b7b9b3ce07b49660c107..25a044fe88d87019334a70a9befd18c8e60818da 100644 (file)
@@ -51,6 +51,7 @@ class TestsWithServer(TestCaseWithServer):
         self.check_post(post, '/condition', 302, '/condition?id=1')
         # … single /condition
         cond = self.cond_as_dict(titles=['foo'], descriptions=['oof'])
+        assert isinstance(cond['_versioned'], dict)
         expected_single: dict[str, object]
         expected_single = {'is_new': False,
                            'enabled_processes': [],
@@ -72,7 +73,6 @@ class TestsWithServer(TestCaseWithServer):
         # test effect of POST changing title and activeness
         post = {'title': 'bar', 'description': 'oof', 'is_active': True}
         self.check_post(post, '/condition?id=1', 302)
-        assert isinstance(cond['_versioned'], dict)
         cond['_versioned']['title'][1] = 'bar'
         cond['is_active'] = True
         self.check_json_get('/condition?id=1', expected_single)
@@ -102,8 +102,12 @@ class TestsWithServer(TestCaseWithServer):
                        'enables': [1], 'blockers': [1]}
         self.post_process(2, proc_2_post)
         cond = self.cond_as_dict(titles=['foo'], descriptions=['oof'])
-        proc_1 = self.proc_as_dict(conditions=[cond], disables=[cond])
-        proc_2 = self.proc_as_dict(2, 'B', blockers=[cond], enables=[cond])
+        assert isinstance(cond['id'], int)
+        proc_1 = self.proc_as_dict(conditions=[cond['id']],
+                                   disables=[cond['id']])
+        proc_2 = self.proc_as_dict(2, 'B',
+                                   blockers=[cond['id']],
+                                   enables=[cond['id']])
         expected = {'is_new': False,
                     'enabled_processes': self.as_id_list([proc_1]),
                     'disabled_processes': self.as_id_list([proc_2]),