Skip to content

Commit

Permalink
Fixing process test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazim-crim committed Nov 6, 2024
1 parent 4ee2247 commit a71187d
Showing 1 changed file with 109 additions and 28 deletions.
137 changes: 109 additions & 28 deletions tests/wps_restapi/test_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,11 @@ def assert_deployed_wps3(response_json, expected_process_id, assert_io=True):
# assert proc["outputs"][0]["minOccurs"] == "1"
# assert proc["outputs"][0]["maxOccurs"] == "1"
assert isinstance(proc["outputs"][0]["formats"], list)
assert len(proc["outputs"][0]["formats"]) == 1
assert len(proc["outputs"][0]["formats"]) == 4 # Alternate format representation added
assert proc["outputs"][0]["formats"][0]["mediaType"] == ContentType.APP_JSON
assert proc["outputs"][0]["formats"][1]["mediaType"] == ContentType.TEXT_CSV
assert proc["outputs"][0]["formats"][2]["mediaType"] == ContentType.APP_XML
assert proc["outputs"][0]["formats"][3]["mediaType"] == ContentType.APP_YAML

def deploy_process_make_visible_and_fetch_deployed(self,
deploy_payload, # type: JSON
Expand Down Expand Up @@ -988,8 +991,21 @@ def deploy_process_CWL_direct(self,
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]
return cwl, desc # type: ignore

Expand Down Expand Up @@ -1078,11 +1094,24 @@ def test_deploy_process_CWL_DockerRequirement_href(self):
assert proc["id"] == p_id
assert proc["inputs"] == []
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
}]
"id": "output",
"title": "output",
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]

def test_deploy_process_CWL_DockerRequirement_owsContext(self):
with contextlib.ExitStack() as stack:
Expand Down Expand Up @@ -1118,11 +1147,24 @@ def test_deploy_process_CWL_DockerRequirement_owsContext(self):
assert proc["id"] == p_id
assert proc["inputs"] == []
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
}]
"id": "output",
"title": "output",
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]

def test_deploy_process_CWL_DockerRequirement_executionUnit(self):
with contextlib.ExitStack() as stack:
Expand Down Expand Up @@ -1156,11 +1198,24 @@ def test_deploy_process_CWL_DockerRequirement_executionUnit(self):
assert proc["id"] == p_id
assert proc["inputs"] == []
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
}]
"id": "output",
"title": "output",
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]

def test_deploy_process_CWL_DockerRequirement_executionUnit_DirectUnit(self):
with contextlib.ExitStack() as stack:
Expand Down Expand Up @@ -1194,11 +1249,24 @@ def test_deploy_process_CWL_DockerRequirement_executionUnit_DirectUnit(self):
assert proc["id"] == p_id
assert proc["inputs"] == []
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
}]
"id": "output",
"title": "output",
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]

def test_deploy_process_CWL_DockerRequirement_executionUnit_UnitWithMediaType(self):
with contextlib.ExitStack() as stack:
Expand Down Expand Up @@ -1232,11 +1300,24 @@ def test_deploy_process_CWL_DockerRequirement_executionUnit_UnitWithMediaType(se
assert proc["id"] == p_id
assert proc["inputs"] == []
assert proc["outputs"] == [{
"id": "output",
"title": "output",
"schema": {"type": "string", "contentMediaType": "text/plain"},
"formats": [{"default": True, "mediaType": "text/plain"}]
}]
"id": "output",
"title": "output",
"schema": {
"oneOf": [
{
"type": "string",
"contentMediaType": "text/plain"
},
{
"type": "string",
"format": "binary",
"contentMediaType": "application/pdf",
"contentEncoding": "base64"
}
]
},
"formats": [{"default": True, "mediaType": "text/plain"}, {"mediaType": "application/pdf"}]
}]

@pytest.mark.usefixtures("assert_cwl_no_warn_unknown_hint")
@pytest.mark.parametrize("assert_cwl_no_warn_unknown_hint", [CWL_REQUIREMENT_CUDA_NAME], indirect=True)
Expand Down

0 comments on commit a71187d

Please sign in to comment.