Skip to content

Instantly share code, notes, and snippets.

@klen
Created December 10, 2014 11:04
Show Gist options
  • Save klen/2693899f5e7f375620e9 to your computer and use it in GitHub Desktop.
Save klen/2693899f5e7f375620e9 to your computer and use it in GitHub Desktop.
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