-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/InformaticsMatters/data-man…
…ager-job-decoder into main
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Tests for the decoder's get_inputs() function. | ||
from typing import Dict | ||
|
||
import pytest | ||
|
||
pytestmark = pytest.mark.unit | ||
|
||
from decoder import decoder | ||
|
||
|
||
def test_get_inputs_when_none(): | ||
# Arrange | ||
job_definition: Dict = {} | ||
|
||
# Act | ||
inputs = decoder.get_inputs(job_definition) | ||
|
||
# Assert | ||
assert inputs == {} | ||
|
||
|
||
def test_get_inputs(): | ||
# Arrange | ||
job_definition: Dict = { | ||
"variables": { | ||
"inputs": { | ||
"properties": { | ||
"inputFile": { | ||
"title": "PDB File", | ||
"mime-types": ["chemical/x-pdb"], | ||
"type": "file", | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
# Act | ||
inputs = decoder.get_inputs(job_definition) | ||
|
||
# Assert | ||
assert inputs | ||
assert "inputFile" in inputs | ||
assert inputs["inputFile"]["title"] == "PDB File" | ||
assert inputs["inputFile"]["mime-types"] == ["chemical/x-pdb"] | ||
assert inputs["inputFile"]["type"] == "file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Tests for the decoder's get_outputs() function. | ||
from typing import Dict | ||
|
||
import pytest | ||
|
||
pytestmark = pytest.mark.unit | ||
|
||
from decoder import decoder | ||
|
||
|
||
def test_get_outputs_when_none(): | ||
# Arrange | ||
job_definition: Dict = {} | ||
|
||
# Act | ||
outputs = decoder.get_outputs(job_definition) | ||
|
||
# Assert | ||
assert outputs == {} | ||
|
||
|
||
def test_get_outputs(): | ||
# Arrange | ||
job_definition: Dict = { | ||
"variables": { | ||
"outputs": { | ||
"properties": { | ||
"pdbFile": { | ||
"title": "PDB File", | ||
"mime-types": ["chemical/x-pdb"], | ||
"type": "file", | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
# Act | ||
outputs = decoder.get_outputs(job_definition) | ||
|
||
# Assert | ||
assert outputs | ||
assert "pdbFile" in outputs | ||
assert outputs["pdbFile"]["title"] == "PDB File" | ||
assert outputs["pdbFile"]["mime-types"] == ["chemical/x-pdb"] | ||
assert outputs["pdbFile"]["type"] == "file" |