Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job output transform #548

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
07a27e7
Transformer Implementation
OlivGruwe Jun 7, 2023
3c1ef15
Transformer Implementation
OlivGruwe Jun 7, 2023
6d23b4c
Transformer Implementation +
OlivGruwe Jun 12, 2023
d85aa30
Transformer Implementation
OlivGruwe Jun 12, 2023
b02bb01
Transformer Implementation
OlivGruwe Jun 12, 2023
d7c727f
Transformer Implementation
OlivGruwe Jun 12, 2023
b3b4f52
Transformer Implementation
OlivGruwe Jun 12, 2023
dcde84e
Correction Txt -> Pdf
OlivGruwe Jul 3, 2023
d6b8c6c
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Sep 24, 2024
b3048bb
Fixing naming typos
Nazim-crim Sep 24, 2024
a23519e
Adding libpangocairo to dockerfile
Nazim-crim Sep 24, 2024
ee9c208
Fixing import and linting
Nazim-crim Sep 25, 2024
a8d4473
Fixing docker call and removing unused code
Nazim-crim Sep 26, 2024
574314c
Removing transformer route and test in job, fixing makefile
Nazim-crim Sep 26, 2024
0304b3a
Adding swagger and endpoint definition to support outputId and resultId
Nazim-crim Sep 26, 2024
4cf0e80
Adding in config output and result service
Nazim-crim Oct 1, 2024
81721dd
Fixing test to use transformer resource path
Nazim-crim Oct 11, 2024
e66c582
Fix transform function any to pdf and any to html for transform test …
Nazim-crim Oct 11, 2024
34cd699
Fix import lint
Nazim-crim Oct 11, 2024
fe71427
fixing some linting
Nazim-crim Oct 15, 2024
71f6f96
Adding get job output route
Nazim-crim Oct 15, 2024
34ddd87
Fxing more linting
Nazim-crim Oct 15, 2024
5fe2af0
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Oct 15, 2024
9fedeb7
Remove duplicate code from merge
Nazim-crim Oct 15, 2024
13d3d17
Update get job output to use get_job_results_single and refactor tran…
Nazim-crim Oct 15, 2024
bc14eac
fix docstring
Nazim-crim Oct 15, 2024
a837ff0
Fixing wps api test
Nazim-crim Oct 25, 2024
037a8a4
Fix test and transform to use conversion list and content type from f…
Nazim-crim Oct 28, 2024
a658579
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Oct 28, 2024
38314b6
Modify offering to add alternate formats to format in process and test
Nazim-crim Nov 5, 2024
472ac6b
Remove call of get_all_possible_formats_links in get outputs endpoint
Nazim-crim Nov 5, 2024
4ee2247
Fix wps package test and offering method for edge case where formats …
Nazim-crim Nov 5, 2024
a71187d
Fixing process test
Nazim-crim Nov 6, 2024
e6143b5
Fixing json indent
Nazim-crim Nov 6, 2024
6bfb158
Fixing typo and adding missing format in test
Nazim-crim Nov 6, 2024
7591617
Fixing pep8
Nazim-crim Nov 6, 2024
41147b0
fix single quote
Nazim-crim Nov 6, 2024
3448038
Fixing providers test and fix empty line eof
Nazim-crim Nov 6, 2024
ce4bbb3
Adding test files for different conversion
Nazim-crim Nov 7, 2024
9d823e8
Adding create content id, fixing test with additional format type
Nazim-crim Nov 7, 2024
969f76b
Adding excluded in transform and fixing link parsing
Nazim-crim Nov 8, 2024
42c772d
Fixing make result link and adding URN schema
Nazim-crim Nov 8, 2024
e4c3194
Fixing kwargs parsing
Nazim-crim Nov 8, 2024
c3b0db7
Fixing make link header and adding test, fix old test
Nazim-crim Nov 14, 2024
7544834
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Nov 14, 2024
a7fb477
Fixing write images and adding coverage
Nazim-crim Nov 14, 2024
bf1118d
Adding docstring and typing, fixing test to use parametrize
Nazim-crim Nov 14, 2024
3c24142
Adding change log entry and fixing import
Nazim-crim Nov 15, 2024
7c1ff74
Using smaller tests files
Nazim-crim Nov 18, 2024
e70233e
Using contentType class for test
Nazim-crim Nov 18, 2024
32bdb81
Fixing comment indent, removing unused code
Nazim-crim Nov 26, 2024
a7f8216
Wrap test in try finally
Nazim-crim Nov 29, 2024
c017929
Fixing docstring, removing unused function
Nazim-crim Nov 29, 2024
2ce3667
Fixing doc, requirements ordering and removing print
Nazim-crim Dec 12, 2024
f9aee2f
Fixing cli formating, swagger def and correcting wps_package assert
Nazim-crim Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Changes

Changes:
--------
- Add support for various GeoTIFF formats, allowing flexible handling and representation of GeoTIFFs in outputs
(fixes `#100 <https://github.com/crim-ca/weaver/issues/100>`_).
- Add support for ``GET /results/{id}`` and `` GET /outputs/{id}`` routes to enable direct access to individual
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update paths to start with the /jobs/{jobId}/...

Remove the extra space between `` and GET causing bad parsing.

job result items by ID. This enhancement includes: support alternate representations based on the Accept header.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • remove :
  • add `` to Accept

If an alternate format (e.g., YAML for a JSON source) is requested it will be automatically generated and returned.
Link headers containing all possible output formats, allowing retrieval via query parameters
(e.g., output?f=application/x-yaml). (fixes `#18 <https://github.com/crim-ca/weaver/issues/18>`_).
Comment on lines +20 to +21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a separate item, and apply Link formatting, e.g.:

"- Return Link headers all possible alternate output formats, ..."

Apply the formatting to the example, and use the full /jobs/{jobId}/... link.

- Add support of *OGC API - Processes - Part 4: Job Management* endpoints for `Job` creation and execution
(fixes `#716 <https://github.com/crim-ca/weaver/issues/716>`_).
- Add `CLI` operations ``update_job``, ``trigger_job`` and ``inputs`` corresponding to the required `Job` operations
Expand Down
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ DOCKER_REPO ?= pavics/weaver
# guess OS (Linux, Darwin,...)
OS_NAME := $(shell uname -s 2>/dev/null || echo "unknown")
CPU_ARCH := $(shell uname -m 2>/dev/null || uname -p 2>/dev/null || echo "unknown")
SUDO ?=

# conda
CONDA_CMD ?= __EMPTY__
Expand Down Expand Up @@ -228,10 +229,10 @@ conda-env-export: ## export the conda environment
install: install-all ## alias for 'install-all' target

.PHONY: install-run
install-run: conda-install install-sys install-pkg install-raw ## install requirements and application to run locally
install-run: conda-install install-sys install-pkg install-raw install-dev install-transform ## install requirements and application to run locally

.PHONY: install-all
install-all: conda-install install-sys install-pkg install-pip install-dev ## install application with all dependencies
install-all: conda-install install-sys install-pkg install-pip install-dev install-transform ## install application with all dependencies

.PHONY: install-doc
install-doc: install-pip ## install documentation dependencies
Expand Down Expand Up @@ -274,7 +275,7 @@ install-raw: ## install without any requirements or dependencies (suppose everyt
install-npm: ## install npm package manager and dependencies if they cannot be found
@[ -f "$(shell which npm)" ] || ( \
echo "Binary package manager npm not found. Attempting to install it."; \
apt-get install npm \
$(SUDO) apt-get install npm \
)

.PHONY: install-npm-stylelint
Expand All @@ -291,6 +292,16 @@ install-npm-remarklint: install-npm ## install remark-lint dependency for 'chec
npm install --save-dev \
)

.PHONY: install-transform
install-transform: install-cairo-dependencies # install-transform dependencies

.PHONY: install-cairo-dependencies
install-cairo-dependencies: ## install required dependencies for Transformer
@[ -f "$(shell which cairo)" ] || ( \
echo "Binary package manager cairo not found. Attempting to install it."; \
$(SUDO) apt-get install libpangocairo-1.0-0 \
)

.PHONY: install-dev-npm
install-dev-npm: install-npm install-npm-remarklint install-npm-remarklint ## install all npm development dependencies

Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
git \
nodejs \
libpangocairo-1.0-0 \
&& pip install --no-cache-dir --upgrade -r requirements-sys.txt \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir -e ${APP_DIR} \
Expand Down
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ boto3-stubs[s3]
# https://github.com/celery/billiard/issues/313
billiard>2; sys_platform != "win32" # avoid issue with use_2to3
billiard>3.2,<3.4; sys_platform == "win32"
cairosvg
# pymongo>=4 breaks for some kombu combinations corresponding to pinned Celery
# - https://github.com/crim-ca/weaver/issues/386
# - https://github.com/celery/kombu/pull/1536
Expand Down Expand Up @@ -50,6 +51,7 @@ duration
esgf-compute-api @ git+https://github.com/ESGF/[email protected]
# invalid 'zarr' requirement in 'geotiff' dependencies required by 'pywps' fail to install
# (https://github.com/KipCrossing/geotiff/pull/59)
fpdf
geotiff>=0.2.8
# gunicorn >20 breaks some config.ini loading parameters (paste)
# use pserve to continue supporting config.ini with paste settings
Expand All @@ -58,6 +60,7 @@ gunicorn>=22
# even more reduced dependency constraints (https://github.com/vinitkumar/json2xml/pull/195)
json2xml==4.1.0
jsonschema>=3.0.1

# FIXME: kombu for pymongo>=4 not yet released as 5.3.0 (only pre-releases available)
# - https://github.com/crim-ca/weaver/issues/386
# - https://github.com/celery/kombu/pull/1536
Expand All @@ -68,13 +71,16 @@ mako
# force use of later mistune (https://github.com/common-workflow-language/schema_salad/pull/619#issuecomment-1346025607)
# employed by cwltool -> schema-salad -> mistune
#mistune>=2.0.3,<2.1
multipagetiff
mypy_boto3_s3
numpy>=1.22.2,<2; python_version < "3.10"
numpy>=1.22.2; python_version >= "3.10"
# esgf-compute-api (cwt) needs oauthlib but doesn't add it in their requirements
oauthlib
owslib==0.29.3
pandas
PasteDeploy>=3.1.0; python_version >= "3.12"
Pillow
pint
psutil
# notes: https://github.com/geopython/pygeofilter
Expand Down Expand Up @@ -102,9 +108,11 @@ pystac
pystac_client
python-box
python-dateutil
python-magic
pytz
pywps==4.6.0
pyyaml>=5.2
rasterio
rdflib>=5 # pyup: ignore
requests>=2.32.2
requests_file
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ def test_describe(self):
for out_fmt in output_formats:
out_fmt.pop("$schema", None)
out_fmt.pop("$id", None)
assert output_formats == [{"default": True, "mediaType": ContentType.TEXT_PLAIN}]
assert output_formats == [{"default": True, "mediaType": ContentType.TEXT_PLAIN},
{"mediaType": ContentType.TEXT_HTML},
{"mediaType": ContentType.APP_PDF}
]
assert "undefined" not in result.message, "CLI should not have confused process description as response detail."
assert result.body["description"] == (
"Dummy process that simply echo's back the input message for testing purposes."
Expand Down
84 changes: 55 additions & 29 deletions tests/functional/test_wps_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ def test_deploy_process_io_no_format_default(self):
expect_outputs["file"]["formats"][0]["default"] = False
expect_outputs["file"]["formats"][1]["default"] = True
expect_outputs["file"]["formats"][2]["default"] = False
# Alternate type added automatically in offering.
alternative_formats = [
{"mediaType": ContentType.IMAGE_GIF},
{"mediaType": ContentType.IMAGE_TIFF},
{"mediaType": ContentType.IMAGE_SVG_XML},
{"mediaType": ContentType.APP_PDF}
]
expect_outputs["file"]["formats"].extend(alternative_formats)
expect_outputs["file"]["schema"] = {
Comment on lines +577 to 578
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema should also be updated with the alternate formats.
If not, the place where formats gets extended is missing a step.

Not sure if the check is incorrect here, since I've seen other tests where you checked that the schemas were extended... to investigate.

"oneOf": [
{"type": "string", "format": "binary",
Expand Down Expand Up @@ -1508,14 +1516,20 @@ def test_deploy_merge_complex_io_with_multiple_formats_and_defaults(self):
# assert "default" not in format_spec

assert proc["outputs"][0]["id"] == "single_value_single_format"
assert len(proc["outputs"][0]["formats"]) == 1
assert len(proc["outputs"][0]["formats"]) == 4 # Alternative format added in process
assert proc["outputs"][0]["formats"][0]["mediaType"] == ContentType.APP_JSON
assert proc["outputs"][0]["formats"][0]["default"] is True
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
assert proc["outputs"][1]["id"] == "single_value_multi_format"
assert len(proc["outputs"][1]["formats"]) == 3
assert len(proc["outputs"][1]["formats"]) == 6 # Alternative format added in process
assert proc["outputs"][1]["formats"][0]["mediaType"] == ContentType.APP_JSON
assert proc["outputs"][1]["formats"][1]["mediaType"] == ContentType.TEXT_PLAIN
assert proc["outputs"][1]["formats"][2]["mediaType"] == ContentType.APP_NETCDF
assert proc["outputs"][1]["formats"][3]["mediaType"] == ContentType.TEXT_CSV
assert proc["outputs"][1]["formats"][4]["mediaType"] == ContentType.APP_XML
assert proc["outputs"][1]["formats"][5]["mediaType"] == ContentType.APP_YAML
assert proc["outputs"][1]["formats"][0]["default"] is True # mandatory
assert proc["outputs"][1]["formats"][1].get("default", False) is False # omission is allowed
assert proc["outputs"][1]["formats"][2].get("default", False) is False # omission is allowed
Expand Down Expand Up @@ -3042,10 +3056,12 @@ def test_deploy_merge_complex_io_from_package(self):
assert "minOccurs" not in proc["outputs"][0]
assert "maxOccurs" not in proc["outputs"][0]
assert isinstance(proc["outputs"][0]["formats"], list)
assert len(proc["outputs"][0]["formats"]) == 1
assert len(proc["outputs"][0]["formats"]) == 3
assert isinstance(proc["outputs"][0]["formats"][0], dict)
assert proc["outputs"][0]["formats"][0]["mediaType"] == ContentType.TEXT_PLAIN
assert proc["outputs"][0]["formats"][0]["default"] is True
assert proc["outputs"][0]["formats"][1]["mediaType"] == ContentType.TEXT_HTML
assert proc["outputs"][0]["formats"][2]["mediaType"] == ContentType.APP_PDF
expect = KNOWN_PROCESS_DESCRIPTION_FIELDS
fields = set(proc.keys()) - expect
assert len(fields) == 0, f"Unexpected fields found:\n Unknown: {fields}\n Expected: {expect}"
Expand Down Expand Up @@ -3145,15 +3161,23 @@ def test_deploy_merge_complex_io_from_package_and_offering(self):
assert isinstance(proc["outputs"], list)
assert len(proc["outputs"]) == 2
assert proc["outputs"][0]["id"] == "complex_output_only_cwl_minimal"
assert len(proc["outputs"][0]["formats"]) == 1, \
"Default format should be added to process definition when omitted from both CWL and WPS"
assert len(proc["outputs"][0]["formats"]) == 3, (
"Default format and alternate formats should be added "
"to process definition when omitted from both CWL and WPS"
)
assert proc["outputs"][0]["formats"][0]["mediaType"] == ContentType.TEXT_PLAIN
assert proc["outputs"][0]["formats"][0]["default"] is True
assert proc["outputs"][0]["formats"][1]["mediaType"] == ContentType.TEXT_HTML
assert proc["outputs"][0]["formats"][2]["mediaType"] == ContentType.APP_PDF
assert proc["outputs"][1]["id"] == "complex_output_both_cwl_and_wps"
assert len(proc["outputs"][1]["formats"]) == 1, \
"Default format should be added to process definition when omitted from both CWL and WPS"
assert len(proc["outputs"][1]["formats"]) == 3, (
"Default format and alternate formats should be added "
"to process definition when omitted from both CWL and WPS"
)
assert proc["outputs"][1]["formats"][0]["mediaType"] == ContentType.TEXT_PLAIN
assert proc["outputs"][1]["formats"][0]["default"] is True
assert proc["outputs"][1]["formats"][1]["mediaType"] == ContentType.TEXT_HTML
assert proc["outputs"][1]["formats"][2]["mediaType"] == ContentType.APP_PDF
assert proc["outputs"][1]["title"] == "Additional detail only within WPS output", \
"Additional details defined only in WPS matching CWL I/O by ID should be preserved"

Expand Down Expand Up @@ -3271,9 +3295,11 @@ def test_deploy_literal_and_complex_io_from_wps_xml_reference(self):
assert proc["outputs"][1]["description"] == "Collected logs during process run."
assert "minOccurs" not in proc["outputs"][1]
assert "maxOccurs" not in proc["outputs"][1]
assert len(proc["outputs"][1]["formats"]) == 1
assert len(proc["outputs"][1]["formats"]) == 3
assert proc["outputs"][1]["formats"][0]["default"] is True
assert proc["outputs"][1]["formats"][0]["mediaType"] == ContentType.TEXT_PLAIN
assert proc["outputs"][1]["formats"][1]["mediaType"] == ContentType.TEXT_HTML
assert proc["outputs"][1]["formats"][2]["mediaType"] == ContentType.APP_PDF

def test_deploy_enum_array_and_multi_format_inputs_from_wps_xml_reference(self):
body = {
Expand Down Expand Up @@ -4118,8 +4144,9 @@ def test_execute_single_output_response_raw_reference_literal(self):
assert results.content_type is None
assert results.headers["Content-Location"] == results_href
assert ("Link", output_data_link) in results.headerlist
rel_pattern = re.compile(r"rel=\"?([^\"]+)\"?")
assert not any(
any(out_id in link[-1] for out_id in ["output_json", "output_text"])
any(out_id in rel_pattern.search(link[1]).group(1) for out_id in ["output_json", "output_text"])
for link in results.headerlist if link[0] == "Link"
), "Filtered outputs should not be found in results response links."
outputs = self.app.get(f"/jobs/{job_id}/outputs", params={"schema": JobInputsOutputsSchema.OGC_STRICT})
Expand Down Expand Up @@ -4345,9 +4372,7 @@ def test_execute_single_output_multipart_accept_link(self):
},
}

# FIXME: implement (https://github.com/crim-ca/weaver/pull/548)
@pytest.mark.oap_part1
@pytest.mark.xfail(reason="not implemented")
def test_execute_single_output_multipart_accept_alt_format(self):
"""
Validate the returned contents combining an ``Accept`` header as ``multipart`` and a ``format`` in ``outputs``.
Expand Down Expand Up @@ -4402,22 +4427,24 @@ def test_execute_single_output_multipart_accept_alt_format(self):
output_json_as_yaml = yaml.safe_dump({"data": "test"})
results_body = self.fix_result_multipart_indent(f"""
--{boundary}
Content-Disposition: attachment; name="output_json"; filename="result.yml"
Content-Type: {ContentType.APP_YAML}
Content-Location: {out_url}/{job_id}/output_json/result.yml
Content-ID: <output_json@{job_id}>
Content-Length: 12
Content-Length: 11

{output_json_as_yaml}
--{boundary}--
""")
results_text = self.remove_result_multipart_variable(results.text)
assert results.content_type.startswith(ContentType.MULTIPART_MIXED)
assert results_text == results_body
for line1, line2 in zip(results_text.splitlines(), results_body.splitlines()):
assert line1 == line2
outputs = self.app.get(f"/jobs/{job_id}/outputs", params={"schema": JobInputsOutputsSchema.OGC_STRICT})
assert outputs.content_type.startswith(ContentType.APP_JSON)
assert outputs.json["outputs"] == {
"output_data": "test",
"output_json": {
"href": f"{out_url}/{job_id}/output_json/output.yml",
"href": f"{out_url}/{job_id}/output_json/result.yml",
"type": ContentType.APP_YAML,
},
}
Expand All @@ -4426,11 +4453,9 @@ def test_execute_single_output_multipart_accept_alt_format(self):
result_json = self.app.get(f"/jobs/{job_id}/results/output_json", headers=self.json_headers)
assert result_json.status_code == 200, f"Failed with: [{resp.status_code}]\nReason:\n{resp.text}"
assert result_json.content_type == ContentType.APP_JSON
assert result_json.text == "{\"data\":\"test\"}"
assert result_json.text == "{\"data\": \"test\"}"

# FIXME: implement (https://github.com/crim-ca/weaver/pull/548)
@pytest.mark.oap_part1
@pytest.mark.xfail(reason="not implemented")
def test_execute_single_output_response_document_alt_format_yaml(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_name(proc)
Expand Down Expand Up @@ -4479,32 +4504,34 @@ def test_execute_single_output_response_document_alt_format_yaml(self):
output_json_as_yaml = yaml.safe_dump({"data": "test"})
results_body = self.fix_result_multipart_indent(f"""
--{boundary}
Content-Disposition: attachment; name="output_json"; filename="result.yml"
Content-Type: {ContentType.APP_YAML}
Content-Location: {out_url}/{job_id}/output_json/result.yml
Content-ID: <output_json@{job_id}>
Content-Length: 12
Content-Length: 11

{output_json_as_yaml}
--{boundary}--
""")
results_text = self.remove_result_multipart_variable(results.text)
assert results.content_type.startswith(ContentType.MULTIPART_MIXED)
assert results_text == results_body
for line1, line2 in zip(results_text.splitlines(), results_body.splitlines()):
assert line1 == line2

outputs = self.app.get(f"/jobs/{job_id}/outputs", params={"schema": JobInputsOutputsSchema.OGC_STRICT})
assert outputs.content_type.startswith(ContentType.APP_JSON)
assert outputs.json["outputs"] == {
"output_data": "test",
"output_json": {
"href": f"{out_url}/{job_id}/output_json/output.yml",
"href": f"{out_url}/{job_id}/output_json/result.yml",
"type": ContentType.APP_YAML,
},
}

# FIXME: implement (https://github.com/crim-ca/weaver/pull/548)
# validate the results can be obtained with the "real" representation
result_json = self.app.get(f"/jobs/{job_id}/results/output_json", headers=self.json_headers)
assert result_json.status_code == 200, f"Failed with: [{resp.status_code}]\nReason:\n{resp.text}"
assert result_json.content_type == ContentType.APP_JSON
assert result_json.text == "{\"data\":\"test\"}"
assert result_json.text == "{\"data\": \"test\"}"

@pytest.mark.oap_part1
def test_execute_single_output_response_document_alt_format_json_raw_literal(self):
Expand Down Expand Up @@ -4571,12 +4598,11 @@ def test_execute_single_output_response_document_alt_format_json_raw_literal(sel
},
}

# FIXME: add check of direct request of output (https://github.com/crim-ca/weaver/pull/548)
# validate the results can be obtained with the "real" representation
# result_json = self.app.get(f"/jobs/{job_id}/results/output_json", headers=self.json_headers)
# assert result_json.status_code == 200, f"Failed with: [{resp.status_code}]\nReason:\n{resp.json}"
# assert result_json.content_type == ContentType.APP_JSON
# assert result_json.json == {"data": "test"}
result_json = self.app.get(f"/jobs/{job_id}/results/output_json", headers=self.json_headers)
assert result_json.status_code == 200, f"Failed with: [{resp.status_code}]\nReason:\n{resp.json}"
assert result_json.content_type == ContentType.APP_JSON
assert result_json.json == {"data": "test"}

@pytest.mark.oap_part1
def test_execute_single_output_response_document_default_format_json_special(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/test_wps_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ def test_register_describe_execute_ncdump(self, mock_responses):
assert "outputs" in body and len(body["outputs"]) == 1
assert "output" in body["outputs"]
assert "formats" in body["outputs"]["output"]
assert len(body["outputs"]["output"]["formats"]) == 1
assert len(body["outputs"]["output"]["formats"]) == 3
assert body["outputs"]["output"]["formats"][0]["default"] is True
assert body["outputs"]["output"]["formats"][0]["mediaType"] == ContentType.TEXT_PLAIN
assert body["outputs"]["output"]["formats"][1]["mediaType"] == ContentType.TEXT_HTML
assert body["outputs"]["output"]["formats"][2]["mediaType"] == ContentType.APP_PDF
assert "literalDataDomains" not in body["outputs"]["output"]

assert body["processDescriptionURL"] == proc_desc_url
Expand Down
Loading
Loading