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

Ensure stages are supplied

parent 6eaff8dd
No related branches found
No related tags found
No related merge requests found
...@@ -6,8 +6,15 @@ from .workflow import Workflow, Stage ...@@ -6,8 +6,15 @@ from .workflow import Workflow, Stage
class TestWorkflowCreation(SimpleTestCase): class TestWorkflowCreation(SimpleTestCase):
def test_can_create_workflow(self): def test_can_create_workflow(self):
name = 'single_stage' name = 'single_stage'
workflow = Workflow(name) stage = Stage('stage_name')
workflow = Workflow(name, stage)
self.assertEqual(workflow.name, name) self.assertEqual(workflow.name, name)
self.assertCountEqual(workflow.stages, [stage])
def test_stages_required_for_workflow(self):
name = 'single_stage'
with self.assertRaises(ValueError):
Workflow(name)
class TestStageCreation(SimpleTestCase): class TestStageCreation(SimpleTestCase):
......
class Workflow: class Workflow:
def __init__(self, name): def __init__(self, name, *stages):
self.name = name self.name = name
if not stages:
raise ValueError('Stages must be supplied')
self.stages = stages
class Stage: class Stage:
......
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