Skip to content

Instantly share code, notes, and snippets.

@klen

klen/test_flows.py

Created Dec 10, 2014
Embed
What would you like to do?
import pytest
pytestmark = pytest.mark.django_db
def test_quality_flow(mixer, personal):
from core.flows import QualityFlow as flow
org = mixer.blend('core.organization', role='supplier')
# Attach an organization to flow
flow.start.run(org)
qp = flow.process_cls.objects.get()
assert qp
assert qp.organization == org
# Approve a quality request
[approve] = qp.active_tasks()
approve.flow_task.run(qp, reviewer=personal, level=2, approve=True)
qp = flow.process_cls.objects.get()
assert qp.approved
assert qp.level == 2
assert qp.reviewed_by == personal
# Send message to owner
[send_approved] = qp.active_tasks()
send_approved.flow_task.run(qp)
qp = flow.process_cls.objects.get()
assert qp.status == 'DONE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.