From 349fe49e1c293d332e1ed588d2e8de1df0099adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 11 May 2019 23:44:57 +0200 Subject: [PATCH] Changed default workflows. --- CHANGELOG.rst | 2 +- openslides/motions/signals.py | 15 ++++++++++----- tests/integration/motions/test_viewset.py | 10 ++++------ tests/old/motions/test_models.py | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 14967397b..447dc2b8f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -39,7 +39,7 @@ Motions: users. Added new permission to see motions in some internal state [#4235, #4518, #4521]. - Allowed submitters to set state of new motions in complex and customized - workflow [#4236]. + workflow. Changed default workflows. No migration provided [#4236, #4703]. - Added multi select action to manage submitters, categories, motion blocks, tags, states and recommendations [#4037, #4132, #4702]. - Added timestampes for motions [#4134]. diff --git a/openslides/motions/signals.py b/openslides/motions/signals.py index e531b34fd..f0d3bebfe 100644 --- a/openslides/motions/signals.py +++ b/openslides/motions/signals.py @@ -20,7 +20,6 @@ def create_builtin_workflows(sender, **kwargs): workflow=workflow_1, allow_create_poll=True, allow_support=True, - allow_submitter_edit=True, ) state_1_1.save(skip_autoupdate=True) state_1_2 = State( @@ -53,11 +52,17 @@ def create_builtin_workflows(sender, **kwargs): workflow_2 = Workflow(name="Complex Workflow") workflow_2.save(skip_autoupdate=True) + state_2_0 = State( + name="in progress", + workflow=workflow_2, + allow_submitter_edit=True, + dont_set_identifier=True, + ) + state_2_0.save(skip_autoupdate=True) state_2_1 = State( - name="published", + name="submitted", workflow=workflow_2, allow_support=True, - allow_submitter_edit=True, dont_set_identifier=True, ) state_2_1.save(skip_autoupdate=True) @@ -66,7 +71,6 @@ def create_builtin_workflows(sender, **kwargs): workflow=workflow_2, recommendation_label="Permission", allow_create_poll=True, - allow_submitter_edit=True, ) state_2_2.save(skip_autoupdate=True) state_2_3 = State( @@ -131,11 +135,12 @@ def create_builtin_workflows(sender, **kwargs): merge_amendment_into_final=-1, ) state_2_10.save(skip_autoupdate=True) + state_2_0.next_states.add(state_2_1, state_2_5) state_2_1.next_states.add(state_2_2, state_2_5, state_2_10) state_2_2.next_states.add( state_2_3, state_2_4, state_2_5, state_2_6, state_2_7, state_2_8, state_2_9 ) - workflow_2.first_state = state_2_1 + workflow_2.first_state = state_2_0 workflow_2.save(skip_autoupdate=True) diff --git a/tests/integration/motions/test_viewset.py b/tests/integration/motions/test_viewset.py index a11a960aa..7a3062ec6 100644 --- a/tests/integration/motions/test_viewset.py +++ b/tests/integration/motions/test_viewset.py @@ -636,8 +636,8 @@ class UpdateMotion(TestCase): json.dumps({"supporters_id": [1]}), content_type="application/json", ) - self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertFalse(motion.supporters.exists()) + # Forbidden because of changed workflow state. + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) def test_removal_of_supporters(self): # No cache used here. @@ -659,10 +659,8 @@ class UpdateMotion(TestCase): {"title": "new_title_ohph1aedie5Du8sai2ye"}, ) - self.assertEqual(response.status_code, status.HTTP_200_OK) - motion = Motion.objects.get() - self.assertEqual(motion.title, "new_title_ohph1aedie5Du8sai2ye") - self.assertEqual(motion.supporters.count(), 0) + # Forbidden because of changed workflow state. + self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) class DeleteMotion(TestCase): diff --git a/tests/old/motions/test_models.py b/tests/old/motions/test_models.py index 6c2904f83..84f1789f6 100644 --- a/tests/old/motions/test_models.py +++ b/tests/old/motions/test_models.py @@ -24,12 +24,12 @@ class ModelTest(TestCase): self.assertEqual(self.motion.state.name, "submitted") self.motion.state = State.objects.get(pk=5) - self.assertEqual(self.motion.state.name, "published") + self.assertEqual(self.motion.state.name, "in progress") with self.assertRaises(WorkflowError): self.motion.create_poll() self.motion.state = State.objects.get(pk=6) - self.assertEqual(self.motion.state.name, "permitted") + self.assertEqual(self.motion.state.name, "submitted") def test_new_states_or_workflows(self): workflow_1 = Workflow.objects.create(name="W1")