Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Adham Hashibon
force-bdss
Commits
f381a451
Commit
f381a451
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Added workflow reader tests
parent
719835bb
No related branches found
No related tags found
1 merge request
!29
Extract io layer to writer/reader class
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
force_bdss/io/tests/test_workflow_reader.py
+47
-0
47 additions, 0 deletions
force_bdss/io/tests/test_workflow_reader.py
with
47 additions
and
0 deletions
force_bdss/io/tests/test_workflow_reader.py
+
47
−
0
View file @
f381a451
import
json
import
unittest
from
six
import
StringIO
from
force_bdss.bundle_registry_plugin
import
BundleRegistryPlugin
from
force_bdss.io.workflow_reader
import
(
WorkflowReader
,
InvalidVersionException
,
InvalidFileException
)
try
:
import
mock
except
ImportError
:
from
unittest
import
mock
class
TestWorkflowReader
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
mock_bundle_registry
=
mock
.
Mock
(
spec
=
BundleRegistryPlugin
)
self
.
wfreader
=
WorkflowReader
(
self
.
mock_bundle_registry
)
def
test_initialization
(
self
):
self
.
assertEqual
(
self
.
wfreader
.
bundle_registry
,
self
.
mock_bundle_registry
)
def
test_invalid_version
(
self
):
data
=
{
"
version
"
:
"
2
"
}
with
self
.
assertRaises
(
InvalidVersionException
):
self
.
wfreader
.
read
(
self
.
_as_json_stringio
(
data
))
def
test_absent_version
(
self
):
data
=
{
}
with
self
.
assertRaises
(
InvalidFileException
):
self
.
wfreader
.
read
(
self
.
_as_json_stringio
(
data
))
def
_as_json_stringio
(
self
,
data
):
fp
=
StringIO
()
json
.
dump
(
data
,
fp
)
fp
.
seek
(
0
)
return
fp
def
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