X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=tests%2Fconditions.py;h=af5f661d809995e26bdcc681c4dcff73f0fdb7a6;hb=b56761522f6ec874fde1eb9d4d69d8093fe70227;hp=5270812a41e9f7fc369a426876fe316b349e34b7;hpb=9c62e1b0e5c30ed3fd7a49828749db195bc3e557;p=plomtask diff --git a/tests/conditions.py b/tests/conditions.py index 5270812..af5f661 100644 --- a/tests/conditions.py +++ b/tests/conditions.py @@ -9,7 +9,6 @@ from plomtask.exceptions import HandledException class TestsSansDB(TestCaseSansDB): """Tests requiring no DB setup.""" checked_class = Condition - do_id_test = True versioned_defaults_to_test = {'title': 'UNNAMED', 'description': ''} @@ -19,31 +18,9 @@ class TestsWithDB(TestCaseWithDB): default_init_kwargs = {'is_active': False} test_versioneds = {'title': str, 'description': str} - def test_Condition_from_table_row(self) -> None: - """Test .from_table_row() properly reads in class from DB""" - self.check_from_table_row() - self.check_versioned_from_table_row('title', str) - self.check_versioned_from_table_row('description', str) - - def test_Condition_by_id(self) -> None: - """Test .by_id(), including creation.""" - self.check_by_id() - - def test_Condition_all(self) -> None: - """Test .all().""" - self.check_all() - - def test_Condition_singularity(self) -> None: - """Test pointers made for single object keep pointing to it.""" - self.check_singularity('is_active', True) - - def test_Condition_versioned_attributes_singularity(self) -> None: - """Test behavior of VersionedAttributes on saving (with .title).""" - self.check_versioned_singularity() - - def test_Condition_remove(self) -> None: + def test_remove(self) -> None: """Test .remove() effects on DB and cache.""" - self.check_remove() + super().test_remove() proc = Process(None) proc.save(self.db_conn) todo = Todo(None, proc, False, '2024-01-01') @@ -88,31 +65,6 @@ class TestsWithServer(TestCaseWithServer): d['_versioned']['description'][i] = description return d - @staticmethod - def proc_as_dict(id_: int = 1, - title: str = 'A', - enables: None | list[dict[str, object]] = None, - disables: None | list[dict[str, object]] = None, - conditions: None | list[dict[str, object]] = None, - blockers: None | list[dict[str, object]] = None - ) -> dict[str, object]: - """Return JSON of Process to expect.""" - # pylint: disable=too-many-arguments - d = {'id': id_, - 'calendarize': False, - 'suppressed_steps': [], - 'explicit_steps': [], - '_versioned': { - 'title': {0: title}, - 'description': {0: ''}, - 'effort': {0: 1.0} - }, - 'conditions': conditions if conditions else [], - 'disables': disables if disables else [], - 'enables': enables if enables else [], - 'blockers': blockers if blockers else []} - return d - def test_do_POST_condition(self) -> None: """Test POST /condition and its effect on GET /condition[s].""" # check empty POST fails