home · contact · privacy
Split BaseModel.by_id into .by_id and by_id_or_create, refactor tests.
[plomtask] / tests / processes.py
index 34f6427e4d06152a17f035672061757cce203cac..0f43a4dc5685ba79b690b3d4ae6d1a09955283d6 100644 (file)
@@ -63,9 +63,9 @@ class TestsWithDB(TestCaseWithDB):
         self.assertEqual(sorted(r.enables), sorted(set2))
         self.assertEqual(sorted(r.disables), sorted(set3))
 
-    def test_Process_from_table_row(self) -> None:
+    def test_from_table_row(self) -> None:
         """Test .from_table_row() properly reads in class from DB"""
-        self.check_from_table_row()
+        super().test_from_table_row()
         self.check_versioned_from_table_row('title', str)
         self.check_versioned_from_table_row('description', str)
         self.check_versioned_from_table_row('effort', float)
@@ -182,18 +182,6 @@ class TestsWithDB(TestCaseWithDB):
             method(self.db_conn, [c1.id_, c2.id_])
             self.assertEqual(getattr(p, target), [c1, c2])
 
-    def test_Process_by_id(self) -> None:
-        """Test .by_id(), including creation"""
-        self.check_by_id()
-
-    def test_Process_all(self) -> None:
-        """Test .all()."""
-        self.check_all()
-
-    def test_Process_singularity(self) -> None:
-        """Test pointers made for single object keep pointing to it."""
-        self.check_singularity('conditions', [Condition(None)])
-
     def test_Process_versioned_attributes_singularity(self) -> None:
         """Test behavior of VersionedAttributes on saving (with .title)."""
         self.check_versioned_singularity()
@@ -257,7 +245,7 @@ class TestsWithDBForProcessStep(TestCaseWithDB):
         p1.set_steps(self.db_conn, [step])
         step.remove(self.db_conn)
         self.assertEqual(p1.explicit_steps, [])
-        self.check_storage([])
+        self.check_identity_with_cache_and_db([])
 
 
 class TestsWithServer(TestCaseWithServer):
@@ -279,7 +267,8 @@ class TestsWithServer(TestCaseWithServer):
         form_data = {'title': 'foo', 'description': 'foo', 'effort': 1.0}
         self.post_process(2, form_data | {'condition': []})
         self.check_post(form_data | {'condition': [1]}, '/process?id=', 404)
-        self.check_post({'title': 'foo', 'description': 'foo'},
+        self.check_post({'title': 'foo', 'description': 'foo',
+                         'is_active': False},
                         '/condition', 302, '/condition?id=1')
         self.post_process(3, form_data | {'condition': [1]})
         self.post_process(4, form_data | {'disables': [1]})