Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
14325fe2
Commit
14325fe2
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Relate phases to stage
parent
a49f7500
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
opentech/apply/tests/factories.py
+13
-1
13 additions, 1 deletion
opentech/apply/tests/factories.py
opentech/apply/tests/test_workflow.py
+4
-2
4 additions, 2 deletions
opentech/apply/tests/test_workflow.py
opentech/apply/workflow.py
+2
-1
2 additions, 1 deletion
opentech/apply/workflow.py
with
19 additions
and
4 deletions
opentech/apply/tests/factories.py
+
13
−
1
View file @
14325fe2
from
django.forms
import
Form
from
django.forms
import
Form
import
factory
import
factory
from
opentech.apply.workflow
import
Stage
,
Workflow
from
opentech.apply.workflow
import
Phase
,
Stage
,
Workflow
class
PhaseFactory
(
factory
.
Factory
):
class
Meta
:
model
=
Phase
name
=
factory
.
Faker
(
'
word
'
)
class
StageFactory
(
factory
.
Factory
):
class
StageFactory
(
factory
.
Factory
):
class
Meta
:
class
Meta
:
model
=
Stage
model
=
Stage
inline_args
=
(
'
name
'
,
'
form
'
,
'
phases
'
,)
class
Params
:
num_phases
=
factory
.
Faker
(
'
random_int
'
,
min
=
1
,
max
=
3
)
name
=
factory
.
Faker
(
'
word
'
)
name
=
factory
.
Faker
(
'
word
'
)
form
=
factory
.
LazyFunction
(
Form
)
form
=
factory
.
LazyFunction
(
Form
)
phases
=
factory
.
LazyAttribute
(
lambda
o
:
[
PhaseFactory
()
for
_
in
range
(
o
.
num_phases
)])
class
WorkflowFactory
(
factory
.
Factory
):
class
WorkflowFactory
(
factory
.
Factory
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/tests/test_workflow.py
+
4
−
2
View file @
14325fe2
...
@@ -3,7 +3,7 @@ from django.forms import Form
...
@@ -3,7 +3,7 @@ from django.forms import Form
from
opentech.apply.workflow
import
Phase
,
Stage
,
Workflow
from
opentech.apply.workflow
import
Phase
,
Stage
,
Workflow
from
.factories
import
StageFactory
,
WorkflowFactory
from
.factories
import
PhaseFactory
,
StageFactory
,
WorkflowFactory
class
TestWorkflowCreation
(
SimpleTestCase
):
class
TestWorkflowCreation
(
SimpleTestCase
):
...
@@ -37,9 +37,11 @@ class TestStageCreation(SimpleTestCase):
...
@@ -37,9 +37,11 @@ class TestStageCreation(SimpleTestCase):
def
test_can_create_stage
(
self
):
def
test_can_create_stage
(
self
):
name
=
'
the_stage
'
name
=
'
the_stage
'
form
=
Form
()
form
=
Form
()
stage
=
Stage
(
name
,
form
)
phases
=
PhaseFactory
.
create_batch
(
2
)
stage
=
Stage
(
name
,
form
,
phases
)
self
.
assertEqual
(
stage
.
name
,
name
)
self
.
assertEqual
(
stage
.
name
,
name
)
self
.
assertEqual
(
stage
.
form
,
form
)
self
.
assertEqual
(
stage
.
form
,
form
)
self
.
assertEqual
(
stage
.
phases
,
phases
)
class
TestPhaseCreation
(
SimpleTestCase
):
class
TestPhaseCreation
(
SimpleTestCase
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/workflow.py
+
2
−
1
View file @
14325fe2
...
@@ -26,9 +26,10 @@ class Workflow(Iterable['Stage']):
...
@@ -26,9 +26,10 @@ class Workflow(Iterable['Stage']):
class
Stage
:
class
Stage
:
def
__init__
(
self
,
name
:
str
,
form
:
Form
)
->
None
:
def
__init__
(
self
,
name
:
str
,
form
:
Form
,
phases
:
Sequence
[
'
Phase
'
]
)
->
None
:
self
.
name
=
name
self
.
name
=
name
self
.
form
=
form
self
.
form
=
form
self
.
phases
=
phases
class
Phase
:
class
Phase
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment