Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Merge requests
!62
SWS-7: Finish "download" workflow template
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
SWS-7: Finish "download" workflow template
SWS-7-download-workflow-template
into
main
Overview
5
Commits
3
Pipelines
5
Changes
3
1 unresolved thread
Show all comments
Merged
Nathan Hertz
requested to merge
SWS-7-download-workflow-template
into
main
4 years ago
Overview
5
Commits
3
Pipelines
5
Changes
3
1 unresolved thread
Show all comments
Expand
Make it so the download workflow actually works and does things!
Edited
4 years ago
by
Nathan Hertz
0
0
Merge request reports
Compare
main
version 4
9b766720
4 years ago
version 3
4334fa2d
4 years ago
version 2
fa36e2b4
4 years ago
version 1
423017a6
4 years ago
main (base)
and
version 1
latest version
c94b1da1
3 commits,
4 years ago
version 4
9b766720
2 commits,
4 years ago
version 3
4334fa2d
2 commits,
4 years ago
version 2
fa36e2b4
3 commits,
4 years ago
version 1
423017a6
1 commit,
4 years ago
3 files
+
127
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
shared/workspaces/workspaces/capability/test/test_helpers.py
0 → 100644
+
68
−
0
Options
import
pytest
from
workspaces.capability.enums
import
CapabilityStepType
from
workspaces.capability.helpers
import
CapabilityStep
,
MalformedCapabilityStep
def
test_capability_step_from_str
():
"""
Tests that a capability step can be correctly parsed from a string
"""
step_with_val_and_args
=
"
prepare-and-run-workflow deliver [-r, -l ., shared/workspaces/test/test_data/spool/724126739/17A-109.sb33151331.eb33786546.57892.65940042824]
"
step_with_val_and_one_arg
=
"
prepare-and-run-workflow null [-g]
"
step_with_val_and_empty_args
=
"
prepare-and-run-workflow workflow []
"
step_with_val
=
"
prepare-and-run-workflow name_of_workflow
"
step_only_type
=
"
await-qa
"
# Step of the form "step-type step-value [step_arg1, ...]"
step_with_val_and_args
=
CapabilityStep
.
from_str
(
step_with_val_and_args
)
assert
step_with_val_and_args
.
step_type
is
CapabilityStepType
.
PrepareAndRunWorkflow
assert
step_with_val_and_args
.
step_value
==
"
deliver
"
assert
step_with_val_and_args
.
step_args
==
[
"
-r
"
,
"
-l .
"
,
"
shared/workspaces/test/test_data/spool/724126739/17A-109.sb33151331.eb33786546.57892.65940042824
"
,
]
# Step of the form "step-type step-value [step_arg]"
step_with_val_and_one_arg
=
CapabilityStep
.
from_str
(
step_with_val_and_one_arg
)
assert
(
step_with_val_and_one_arg
.
step_type
is
CapabilityStepType
.
PrepareAndRunWorkflow
)
assert
step_with_val_and_one_arg
.
step_value
==
"
null
"
assert
step_with_val_and_one_arg
.
step_args
==
[
"
-g
"
]
# Step of the form "step-type step-value []"
step_with_val_and_empty_args
=
CapabilityStep
.
from_str
(
step_with_val_and_empty_args
)
assert
(
step_with_val_and_empty_args
.
step_type
is
CapabilityStepType
.
PrepareAndRunWorkflow
)
assert
step_with_val_and_empty_args
.
step_value
==
"
workflow
"
assert
step_with_val_and_empty_args
.
step_args
is
None
# Step of the form "step-type step-value"
step_with_val
=
CapabilityStep
.
from_str
(
step_with_val
)
assert
step_with_val
.
step_type
is
CapabilityStepType
.
PrepareAndRunWorkflow
assert
step_with_val
.
step_value
==
"
name_of_workflow
"
assert
step_with_val
.
step_args
is
None
# Step of the form "step-type"
step_only_type
=
CapabilityStep
.
from_str
(
step_only_type
)
assert
step_only_type
.
step_type
is
CapabilityStepType
.
AwaitQA
assert
step_only_type
.
step_value
is
None
assert
step_only_type
.
step_args
is
None
def
test_capability_step_from_str_error
():
"""
Tests that an invalid capability step strings will correctly throw an error
"""
step_empty
=
""
step_bad_format
=
"
!step.type step$value arg1 arg2 arg3
"
step_invalid_type
=
"
invalid-step-type step-value [arg1, arg2]
"
with
pytest
.
raises
(
MalformedCapabilityStep
):
CapabilityStep
.
from_str
(
step_empty
)
CapabilityStep
.
from_str
(
step_bad_format
)
CapabilityStep
.
from_str
(
step_invalid_type
)
Loading