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
84bb498e
Commit
84bb498e
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Add actions as requirement on phases
parent
c60f76dc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
opentech/apply/tests/factories.py
+12
-1
12 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
+11
-8
11 additions, 8 deletions
opentech/apply/workflow.py
with
27 additions
and
11 deletions
opentech/apply/tests/factories.py
+
12
−
1
View file @
84bb498e
from
django.forms
import
Form
from
django.forms
import
Form
import
factory
import
factory
from
opentech.apply.workflow
import
Phase
,
Stage
,
Workflow
from
opentech.apply.workflow
import
Action
,
Phase
,
Stage
,
Workflow
class
ListSubFactory
(
factory
.
SubFactory
):
class
ListSubFactory
(
factory
.
SubFactory
):
...
@@ -26,11 +26,22 @@ class ListSubFactory(factory.SubFactory):
...
@@ -26,11 +26,22 @@ class ListSubFactory(factory.SubFactory):
]
]
class
ActionFactory
(
factory
.
Factory
):
class
Meta
:
model
=
Action
name
=
factory
.
Faker
(
'
word
'
)
class
PhaseFactory
(
factory
.
Factory
):
class
PhaseFactory
(
factory
.
Factory
):
class
Meta
:
class
Meta
:
model
=
Phase
model
=
Phase
class
Params
:
num_actions
=
factory
.
Faker
(
'
random_int
'
,
min
=
1
,
max
=
5
)
name
=
factory
.
Faker
(
'
word
'
)
name
=
factory
.
Faker
(
'
word
'
)
actions
=
ListSubFactory
(
ActionFactory
,
count
=
factory
.
SelfAttribute
(
'
num_actions
'
))
class
StageFactory
(
factory
.
Factory
):
class
StageFactory
(
factory
.
Factory
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/tests/test_workflow.py
+
4
−
2
View file @
84bb498e
...
@@ -3,7 +3,7 @@ from django.forms import Form
...
@@ -3,7 +3,7 @@ from django.forms import Form
from
opentech.apply.workflow
import
Action
,
Phase
,
Stage
,
Workflow
from
opentech.apply.workflow
import
Action
,
Phase
,
Stage
,
Workflow
from
.factories
import
PhaseFactory
,
StageFactory
,
WorkflowFactory
from
.factories
import
ActionFactory
,
PhaseFactory
,
StageFactory
,
WorkflowFactory
class
TestWorkflowCreation
(
SimpleTestCase
):
class
TestWorkflowCreation
(
SimpleTestCase
):
...
@@ -49,9 +49,11 @@ class TestStageCreation(SimpleTestCase):
...
@@ -49,9 +49,11 @@ class TestStageCreation(SimpleTestCase):
class
TestPhaseCreation
(
SimpleTestCase
):
class
TestPhaseCreation
(
SimpleTestCase
):
def
test_can_create_phase
(
self
):
def
test_can_create_phase
(
self
):
actions
=
ActionFactory
.
create_batch
(
2
)
name
=
'
the_phase
'
name
=
'
the_phase
'
phase
=
Phase
(
name
)
phase
=
Phase
(
name
,
actions
)
self
.
assertEqual
(
phase
.
name
,
name
)
self
.
assertEqual
(
phase
.
name
,
name
)
self
.
assertEqual
(
phase
.
actions
,
actions
)
class
TestActions
(
SimpleTestCase
):
class
TestActions
(
SimpleTestCase
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/workflow.py
+
11
−
8
View file @
84bb498e
...
@@ -54,9 +54,10 @@ class Stage(Iterable['Phase']):
...
@@ -54,9 +54,10 @@ class Stage(Iterable['Phase']):
class
Phase
:
class
Phase
:
def
__init__
(
self
,
name
:
str
)
->
None
:
def
__init__
(
self
,
name
:
str
,
actions
:
Sequence
[
'
Action
'
]
)
->
None
:
self
.
name
=
name
self
.
name
=
name
self
.
stage
:
Union
[
'
Stage
'
,
None
]
=
None
self
.
stage
:
Union
[
'
Stage
'
,
None
]
=
None
self
.
actions
=
actions
self
.
occurance
=
0
self
.
occurance
=
0
def
__str__
(
self
):
def
__str__
(
self
):
...
@@ -64,7 +65,7 @@ class Phase:
...
@@ -64,7 +65,7 @@ class Phase:
class
Action
:
class
Action
:
def
__init__
(
self
,
name
:
str
):
def
__init__
(
self
,
name
:
str
)
->
None
:
self
.
name
=
name
self
.
name
=
name
...
@@ -74,17 +75,19 @@ class ReviewPhase(Phase):
...
@@ -74,17 +75,19 @@ class ReviewPhase(Phase):
pass
pass
internal_review
=
ReviewPhase
(
'
Under Review
'
)
next_phase
=
Action
(
'
next
'
)
internal_review
=
ReviewPhase
(
'
Under Review
'
,
[
next_phase
])
ac_review
=
ReviewPhase
(
'
Under Review
'
)
ac_review
=
ReviewPhase
(
'
Under Review
'
,
[
next_phase
]
)
response
=
Phase
(
'
Ready to Respond
'
)
response
=
Phase
(
'
Ready to Respond
'
,
[
next_phase
]
)
rejected
=
Phase
(
'
Rejected
'
)
rejected
=
Phase
(
'
Rejected
'
,
[
next_phase
]
)
accepted
=
Phase
(
'
Accepted
'
)
accepted
=
Phase
(
'
Accepted
'
,
[
next_phase
]
)
progress
=
Phase
(
'
Progress
'
)
progress
=
Phase
(
'
Progress
'
,
[
next_phase
]
)
standard_stage
=
Stage
(
'
Standard
'
,
Form
(),
[
internal_review
,
response
,
ac_review
,
response
,
accepted
,
rejected
])
standard_stage
=
Stage
(
'
Standard
'
,
Form
(),
[
internal_review
,
response
,
ac_review
,
response
,
accepted
,
rejected
])
...
...
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