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
d9fea539
Commit
d9fea539
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Add basic next impliementation
parent
5dd80c88
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/factories.py
+2
-1
2 additions, 1 deletion
opentech/apply/factories.py
opentech/apply/tests.py
+3
-2
3 additions, 2 deletions
opentech/apply/tests.py
opentech/apply/workflow.py
+3
-0
3 additions, 0 deletions
opentech/apply/workflow.py
with
8 additions
and
3 deletions
opentech/apply/factories.py
+
2
−
1
View file @
d9fea539
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/tests.py
+
3
−
2
View file @
d9fea539
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/workflow.py
+
3
−
0
View file @
d9fea539
...
...
@@ -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
:
...
...
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