X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/static/git-logo.png?a=blobdiff_plain;f=tests%2Fconditions.py;h=8f86854f16f0c47aa676b7b9b3ce07b49660c107;hb=1a9557367351fe26d08ea705400b3b56394caae6;hp=7fdd4d44823d5b80b5a788267f82d26a8c53fa12;hpb=21df71ef1fde304b158da5989692c01f463515b5;p=plomtask diff --git a/tests/conditions.py b/tests/conditions.py index 7fdd4d4..8f86854 100644 --- a/tests/conditions.py +++ b/tests/conditions.py @@ -42,27 +42,6 @@ class TestsWithDB(TestCaseWithDB): class TestsWithServer(TestCaseWithServer): """Module tests against our HTTP server/handler (and database).""" - @staticmethod - def cond_as_dict(id_: int = 1, - is_active: bool = False, - titles: None | list[str] = None, - descriptions: None | list[str] = None - ) -> dict[str, object]: - """Return JSON of Condition to expect.""" - d = {'id': id_, - 'is_active': is_active, - '_versioned': { - 'title': {}, - 'description': {}}} - titles = titles if titles else [] - descriptions = descriptions if descriptions else [] - assert isinstance(d['_versioned'], dict) - for i, title in enumerate(titles): - d['_versioned']['title'][i] = title - for i, description in enumerate(descriptions): - d['_versioned']['description'][i] = description - return d - def test_do_POST_condition(self) -> None: """Test POST /condition and its effect on GET /condition[s].""" # check empty POST fails @@ -117,10 +96,10 @@ class TestsWithServer(TestCaseWithServer): form_data = {'title': 'foo', 'description': 'oof', 'is_active': False} self.check_post(form_data, '/condition', 302, '/condition?id=1') proc_1_post = {'title': 'A', 'description': '', 'effort': 1.0, - 'condition': [1], 'disables': [1]} + 'conditions': [1], 'disables': [1]} self.post_process(1, proc_1_post) proc_2_post = {'title': 'B', 'description': '', 'effort': 1.0, - 'enables': [1], 'blocker': [1]} + '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])