Skip to content
Snippets Groups Projects
Commit d9fea539 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add basic next impliementation

parent 5dd80c88
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,11 @@ class StageFactory(factory.Factory):
name = factory.Faker('word')
form = factory.LazyFunction(Form)
.
class WorkflowFactory(factory.Factory):
class Meta:
model = Workflow
inline_args = ('name', 'stages',)
class Params:
num_stages = factory.Faker('random_int', min=1, max=3)
......
......@@ -24,8 +24,9 @@ class TestWorkflowCreation(SimpleTestCase):
for stage, check in zip(workflow, stages):
self.assertEqual(stage, check)
# def test_returns_none_if_no_next_stage(self):
# workflow = Workflow('two_stage', stage1, stage2)
def test_returns_first_stage_if_no_arg(self):
workflow = WorkflowFactory(num_stages=1)
self.assertEqual(workflow.next(), workflow.stages[0])
class TestStageCreation(SimpleTestCase):
......
......@@ -13,6 +13,9 @@ class Workflow(Iterable['Stage']):
def __iter__(self) -> Iterator['Stage']:
yield from self.stages
def next(self):
return self.stages[0]
class Stage:
def __init__(self, name: str, form: Form) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment