def test_workflow_template_transition_create_view_with_access(self):
    self.grant_access(obj=self.test_workflow_template, permission=permission_workflow_template_edit)
    self._clear_events()
    response = self._request_test_workflow_template_transition_create_view()
    self.assertEqual(response.status_code, 302)
    self.assertEqual(WorkflowTransition.objects.count(), 1)
    self.assertEqual(WorkflowTransition.objects.all()[0].label, TEST_WORKFLOW_TEMPLATE_TRANSITION_LABEL)
    self.assertEqual(WorkflowTransition.objects.all()[0].origin_state, self.test_workflow_template_states[0])
    self.assertEqual(WorkflowTransition.objects.all()[0].destination_state, self.test_workflow_template_states[1])
    events = self._get_test_events()
    self.assertEqual(events.count(), 1)
    self.assertEqual(events[0].action_object, self.test_workflow_template_transition)
    self.assertEqual(events[0].actor, self._test_case_user)
    self.assertEqual(events[0].target, self.test_workflow_template)
    self.assertEqual(events[0].verb, event_workflow_template_edited.id)
def test_workflow_template_transition_create_view_with_access(self):
    self.grant_access(obj=self.test_workflow_template, permission=permission_workflow_template_edit)
    self._clear_events()
    response = self._request_test_workflow_template_transition_create_view()
    self.assertEqual(response.status_code, 302)
    self.assertEqual(WorkflowTransition.objects.count(), 1)
    self.assertEqual(WorkflowTransition.objects.all()[0].label, TEST_WORKFLOW_TEMPLATE_TRANSITION_LABEL)
    self.assertEqual(WorkflowTransition.objects.all()[0].origin_state, self.test_workflow_template_states[0])
    self.assertEqual(WorkflowTransition.objects.all()[0].destination_state, self.test_workflow_template_states[1])
    events = self._get_test_events()
    self.assertEqual(events.count(), 1)
    self.assertEqual(events[0].action_object, self.test_workflow_template_transition)
    self.assertEqual(events[0].actor, self._test_case_user)
    self.assertEqual(events[0].target, self.test_workflow_template)
    self.assertEqual(events[0].verb, event_workflow_template_edited.id)