Merge pull request #4703 from normanjaeckel/ChangeDefaultWorkflows

Changed default workflows.
This commit is contained in:
Finn Stutzenstein 2019-05-15 15:54:31 +02:00 committed by GitHub
commit 0ed00ff603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 14 deletions

View File

@ -39,7 +39,7 @@ Motions:
users. Added new permission to see motions in some internal state users. Added new permission to see motions in some internal state
[#4235, #4518, #4521]. [#4235, #4518, #4521].
- Allowed submitters to set state of new motions in complex and customized - 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, - Added multi select action to manage submitters, categories, motion blocks,
tags, states and recommendations [#4037, #4132, #4702]. tags, states and recommendations [#4037, #4132, #4702].
- Added timestampes for motions [#4134]. - Added timestampes for motions [#4134].

View File

@ -20,7 +20,6 @@ def create_builtin_workflows(sender, **kwargs):
workflow=workflow_1, workflow=workflow_1,
allow_create_poll=True, allow_create_poll=True,
allow_support=True, allow_support=True,
allow_submitter_edit=True,
) )
state_1_1.save(skip_autoupdate=True) state_1_1.save(skip_autoupdate=True)
state_1_2 = State( state_1_2 = State(
@ -53,11 +52,17 @@ def create_builtin_workflows(sender, **kwargs):
workflow_2 = Workflow(name="Complex Workflow") workflow_2 = Workflow(name="Complex Workflow")
workflow_2.save(skip_autoupdate=True) 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( state_2_1 = State(
name="published", name="submitted",
workflow=workflow_2, workflow=workflow_2,
allow_support=True, allow_support=True,
allow_submitter_edit=True,
dont_set_identifier=True, dont_set_identifier=True,
) )
state_2_1.save(skip_autoupdate=True) state_2_1.save(skip_autoupdate=True)
@ -66,7 +71,6 @@ def create_builtin_workflows(sender, **kwargs):
workflow=workflow_2, workflow=workflow_2,
recommendation_label="Permission", recommendation_label="Permission",
allow_create_poll=True, allow_create_poll=True,
allow_submitter_edit=True,
) )
state_2_2.save(skip_autoupdate=True) state_2_2.save(skip_autoupdate=True)
state_2_3 = State( state_2_3 = State(
@ -131,11 +135,12 @@ def create_builtin_workflows(sender, **kwargs):
merge_amendment_into_final=-1, merge_amendment_into_final=-1,
) )
state_2_10.save(skip_autoupdate=True) 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_1.next_states.add(state_2_2, state_2_5, state_2_10)
state_2_2.next_states.add( 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 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) workflow_2.save(skip_autoupdate=True)

View File

@ -636,8 +636,8 @@ class UpdateMotion(TestCase):
json.dumps({"supporters_id": [1]}), json.dumps({"supporters_id": [1]}),
content_type="application/json", content_type="application/json",
) )
self.assertEqual(response.status_code, status.HTTP_200_OK) # Forbidden because of changed workflow state.
self.assertFalse(motion.supporters.exists()) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
def test_removal_of_supporters(self): def test_removal_of_supporters(self):
# No cache used here. # No cache used here.
@ -659,10 +659,8 @@ class UpdateMotion(TestCase):
{"title": "new_title_ohph1aedie5Du8sai2ye"}, {"title": "new_title_ohph1aedie5Du8sai2ye"},
) )
self.assertEqual(response.status_code, status.HTTP_200_OK) # Forbidden because of changed workflow state.
motion = Motion.objects.get() self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(motion.title, "new_title_ohph1aedie5Du8sai2ye")
self.assertEqual(motion.supporters.count(), 0)
class DeleteMotion(TestCase): class DeleteMotion(TestCase):

View File

@ -24,12 +24,12 @@ class ModelTest(TestCase):
self.assertEqual(self.motion.state.name, "submitted") self.assertEqual(self.motion.state.name, "submitted")
self.motion.state = State.objects.get(pk=5) 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): with self.assertRaises(WorkflowError):
self.motion.create_poll() self.motion.create_poll()
self.motion.state = State.objects.get(pk=6) 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): def test_new_states_or_workflows(self):
workflow_1 = Workflow.objects.create(name="W1") workflow_1 = Workflow.objects.create(name="W1")