X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;ds=sidebyside;f=tests%2Fprocesses.py;h=6695f78363656cffb5963b539c23bf2444db1703;hb=ee18435127ad396c24dbee2c7efcdbe6810d5a91;hp=c718677f78e7afea5a95fdaa65e3c3981df96f1b;hpb=0ed3bc539d21d5536d0fc635760d88a2231587b9;p=plomtask diff --git a/tests/processes.py b/tests/processes.py index c718677..6695f78 100644 --- a/tests/processes.py +++ b/tests/processes.py @@ -157,6 +157,22 @@ class TestsWithDB(TestCaseWithDB): p_loaded = Process.by_id(self.db_conn, self.proc1.id_) self.assertEqual(self.proc1.title.history, p_loaded.title.history) + def test_Process_removal(self) -> None: + """Test removal of Processes.""" + assert isinstance(self.proc3.id_, int) + self.proc1.remove(self.db_conn) + self.assertEqual({self.proc2.id_, self.proc3.id_}, + set(p.id_ for p in Process.all(self.db_conn))) + self.proc2.set_steps(self.db_conn, [(None, self.proc3.id_, None)]) + self.proc2.explicit_steps[0].remove(self.db_conn) + retrieved = Process.by_id(self.db_conn, self.proc2.id_) + self.assertEqual(retrieved.explicit_steps, []) + self.proc2.set_steps(self.db_conn, [(None, self.proc3.id_, None)]) + step = retrieved.explicit_steps[0] + self.proc2.remove(self.db_conn) + with self.assertRaises(NotFoundException): + ProcessStep.by_id(self.db_conn, step.id_) + class TestsWithServer(TestCaseWithServer): """Module tests against our HTTP server/handler (and database)."""