Fix workflow edit view tests. Improvie workflow view test via test mixins.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
48
mayan/apps/document_states/tests/mixins.py
Normal file
48
mayan/apps/document_states/tests/mixins.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ..models import Workflow, WorkflowState, WorkflowTransition
|
||||
|
||||
from .literals import (
|
||||
TEST_WORKFLOW_INITIAL_STATE_LABEL, TEST_WORKFLOW_INITIAL_STATE_COMPLETION,
|
||||
TEST_WORKFLOW_INTERNAL_NAME, TEST_WORKFLOW_LABEL,
|
||||
TEST_WORKFLOW_STATE_LABEL, TEST_WORKFLOW_STATE_COMPLETION,
|
||||
TEST_WORKFLOW_TRANSITION_LABEL, TEST_WORKFLOW_TRANSITION_LABEL_2
|
||||
)
|
||||
|
||||
|
||||
class WorkflowTestMixin(object):
|
||||
def _create_workflow(self):
|
||||
self.workflow = Workflow.objects.create(
|
||||
label=TEST_WORKFLOW_LABEL,
|
||||
internal_name=TEST_WORKFLOW_INTERNAL_NAME
|
||||
)
|
||||
|
||||
def _create_workflow_states(self):
|
||||
self.workflow_initial_state = WorkflowState.objects.create(
|
||||
workflow=self.workflow, label=TEST_WORKFLOW_INITIAL_STATE_LABEL,
|
||||
completion=TEST_WORKFLOW_INITIAL_STATE_COMPLETION, initial=True
|
||||
)
|
||||
self.workflow_state = WorkflowState.objects.create(
|
||||
workflow=self.workflow, label=TEST_WORKFLOW_STATE_LABEL,
|
||||
completion=TEST_WORKFLOW_STATE_COMPLETION
|
||||
)
|
||||
|
||||
def _create_workflow_transition(self):
|
||||
self.workflow_transition = WorkflowTransition.objects.create(
|
||||
workflow=self.workflow, label=TEST_WORKFLOW_TRANSITION_LABEL,
|
||||
origin_state=self.workflow_initial_state,
|
||||
destination_state=self.workflow_state
|
||||
)
|
||||
|
||||
def _create_workflow_transitions(self):
|
||||
self.workflow_transition = WorkflowTransition.objects.create(
|
||||
workflow=self.workflow, label=TEST_WORKFLOW_TRANSITION_LABEL,
|
||||
origin_state=self.workflow_initial_state,
|
||||
destination_state=self.workflow_state
|
||||
)
|
||||
|
||||
self.workflow_transition_2 = WorkflowTransition.objects.create(
|
||||
workflow=self.workflow, label=TEST_WORKFLOW_TRANSITION_LABEL_2,
|
||||
origin_state=self.workflow_initial_state,
|
||||
destination_state=self.workflow_state
|
||||
)
|
||||
Reference in New Issue
Block a user