Skip to content

Commit

Permalink
[wip] add test markers for various OAP parts affecting /jobs endpoint…
Browse files Browse the repository at this point in the history
…s + prepare tests to validate (relates to opengeospatial/ogcapi-processes#437, relates to #734, relates to #716)
  • Loading branch information
fmigneault committed Oct 15, 2024
1 parent f29c010 commit 00771c7
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 10 deletions.
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ markers =
slow: mark test to be slow
remote: mark test with remote Weaver instance requirement
vault: mark test with Vault file feature validation
html: mark test as related to HTML rendering
oap_part1: mark test as 'OGC API - Processes - Part 1: Core' functionalities
oap_part2: mark test as 'OGC API - Processes - Part 2: Deploy, Replace, Undeploy (DRU)' functionalities
oap_part3: mark test as 'OGC API - Processes - Part 3: Workflows and Chaining' functionalities
oap_part4: mark test as 'OGC API - Processes - Part 4: Job Management' functionalities
filterwarnings =
ignore:No file specified for WPS-1 providers registration:RuntimeWarning
ignore:.*configuration setting.*weaver\.cwl_processes_dir.*:RuntimeWarning
Expand Down
40 changes: 40 additions & 0 deletions tests/functional/test_wps_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3598,6 +3598,7 @@ def fix_result_multipart_indent(results):
res_dedent = res_dedent.rstrip("\n ") # last line often indented less because of closing multiline string
return res_dedent

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_representation_literal(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -3644,6 +3645,7 @@ def test_execute_single_output_prefer_header_return_representation_literal(self)
},
}

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_representation_complex(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -3693,6 +3695,7 @@ def test_execute_single_output_prefer_header_return_representation_complex(self)
},
}

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_minimal_literal_accept_default(self):
"""
For single requested output, without ``Accept`` content negotiation, its default format is returned directly.
Expand Down Expand Up @@ -3746,6 +3749,7 @@ def test_execute_single_output_prefer_header_return_minimal_literal_accept_defau
},
}

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_minimal_literal_accept_json(self):
"""
For single requested output, with ``Accept`` :term:`JSON` content negotiation, document response is returned.
Expand Down Expand Up @@ -3801,6 +3805,7 @@ def test_execute_single_output_prefer_header_return_minimal_literal_accept_json(
},
}

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_minimal_complex_accept_default(self):
"""
For single requested output, without ``Accept`` content negotiation, its default format is returned by link.
Expand Down Expand Up @@ -3880,6 +3885,7 @@ def test_execute_single_output_prefer_header_return_minimal_complex_accept_defau
},
}

@pytest.mark.oap_part1
def test_execute_single_output_prefer_header_return_minimal_complex_accept_json(self):
"""
For single requested output, with ``Accept`` :term:`JSON` content negotiation, document response is returned.
Expand Down Expand Up @@ -3955,6 +3961,7 @@ def test_execute_single_output_prefer_header_return_minimal_complex_accept_json(
},
}

@pytest.mark.oap_part1
def test_execute_single_output_response_raw_value_literal(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -3999,6 +4006,7 @@ def test_execute_single_output_response_raw_value_literal(self):
},
}

@pytest.mark.oap_part1
def test_execute_single_output_response_raw_value_complex(self):
"""
Since value transmission is requested for a single output, its :term:`JSON` contents are returned directly.
Expand Down Expand Up @@ -4054,6 +4062,7 @@ def test_execute_single_output_response_raw_value_complex(self):
},
}

@pytest.mark.oap_part1
def test_execute_single_output_response_raw_reference_literal(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -4113,6 +4122,7 @@ def test_execute_single_output_response_raw_reference_literal(self):
},
}

@pytest.mark.oap_part1
def test_execute_single_output_response_raw_reference_complex(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -4172,6 +4182,7 @@ def test_execute_single_output_response_raw_reference_complex(self):
},
}

@pytest.mark.oap_part1
def test_execute_single_output_multipart_accept_data(self):
"""
Validate that requesting multipart for a single output is permitted.
Expand Down Expand Up @@ -4250,6 +4261,7 @@ def test_execute_single_output_multipart_accept_data(self):
},
}

@pytest.mark.oap_part1
def test_execute_single_output_multipart_accept_link(self):
"""
Validate that requesting multipart for a single output is permitted.
Expand Down Expand Up @@ -4326,6 +4338,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):
"""
Expand Down Expand Up @@ -4408,6 +4421,7 @@ def test_execute_single_output_multipart_accept_alt_format(self):
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"
Expand Down Expand Up @@ -4484,6 +4498,7 @@ def test_execute_single_output_response_document_alt_format_yaml(self):
assert result_json.content_type == ContentType.APP_JSON
assert result_json.text == "{\"data\":\"test\"}"

@pytest.mark.oap_part1
def test_execute_single_output_response_document_alt_format_json_raw_literal(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -4555,6 +4570,7 @@ def test_execute_single_output_response_document_alt_format_json_raw_literal(sel
# 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):
"""
Validate that a :term:`JSON` output is directly embedded in a ``document`` response also using :term:`JSON`.
Expand Down Expand Up @@ -4631,6 +4647,7 @@ def test_execute_single_output_response_document_default_format_json_special(sel
},
}

@pytest.mark.oap_part1
@parameterized.expand([
ContentType.MULTIPART_ANY,
ContentType.MULTIPART_MIXED,
Expand Down Expand Up @@ -4724,6 +4741,7 @@ def test_execute_multi_output_multipart_accept(self, multipart_header):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_multipart_accept_async_not_acceptable(self):
"""
When executing the process asynchronously, ``Accept`` with multipart (strictly) is not acceptable.
Expand Down Expand Up @@ -4766,6 +4784,7 @@ def test_execute_multi_output_multipart_accept_async_not_acceptable(self):
"in": "headers",
}

@pytest.mark.oap_part1
def test_execute_multi_output_multipart_accept_async_alt_acceptable(self):
"""
When executing the process asynchronously, ``Accept`` with multipart and an alternative is acceptable.
Expand Down Expand Up @@ -4806,6 +4825,7 @@ def test_execute_multi_output_multipart_accept_async_alt_acceptable(self):
assert "Preference-Applied" in resp.headers
assert resp.headers["Preference-Applied"] == prefer_header.replace(",", ";")

@pytest.mark.oap_part1
def test_execute_multi_output_prefer_header_return_representation(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -4881,6 +4901,7 @@ def test_execute_multi_output_prefer_header_return_representation(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_raw_value(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -4954,6 +4975,7 @@ def test_execute_multi_output_response_raw_value(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_raw_reference_default_links(self):
"""
All outputs resolved as reference (explicitly or inferred) with raw representation should be all Link headers.
Expand Down Expand Up @@ -5028,6 +5050,7 @@ def test_execute_multi_output_response_raw_reference_default_links(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_raw_reference_accept_multipart(self):
"""
Requesting ``multipart`` explicitly should return it instead of default ``Link`` headers response.
Expand Down Expand Up @@ -5115,6 +5138,7 @@ def test_execute_multi_output_response_raw_reference_accept_multipart(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_raw_mixed(self):
proc = "EchoResultsTester"
p_id = self.fully_qualified_test_process_name(proc)
Expand Down Expand Up @@ -5200,6 +5224,7 @@ def test_execute_multi_output_response_raw_mixed(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_prefer_header_return_minimal_defaults(self):
"""
Test ``Prefer: return=minimal`` with default ``transmissionMode`` resolutions for literal/complex outputs.
Expand Down Expand Up @@ -5264,6 +5289,7 @@ def test_execute_multi_output_prefer_header_return_minimal_defaults(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_prefer_header_return_minimal_override_transmission(self):
"""
Test ``Prefer: return=minimal`` with ``transmissionMode`` overrides.
Expand Down Expand Up @@ -5344,6 +5370,7 @@ def test_execute_multi_output_prefer_header_return_minimal_override_transmission
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_document_defaults(self):
"""
Test ``response: document`` with default ``transmissionMode`` resolutions for literal/complex outputs.
Expand Down Expand Up @@ -5408,6 +5435,7 @@ def test_execute_multi_output_response_document_defaults(self):
},
}

@pytest.mark.oap_part1
def test_execute_multi_output_response_document_mixed(self):
"""
Test ``response: document`` with ``transmissionMode`` specified to force convertion of literal/complex outputs.
Expand Down Expand Up @@ -5485,6 +5513,18 @@ def test_execute_multi_output_response_document_mixed(self):
},
}

@pytest.mark.oap_part4
def test_execute_jobs_sync(self):
raise NotImplementedError # FIMXE: POST /jobs with 'Prefer: wait=X' and return results directly

@pytest.mark.oap_part4
def test_execute_jobs_async(self):
raise NotImplementedError # FIMXE: POST /jobs with 'Prefer: respond-asny' and GET /jobs/{jobId}/results

@pytest.mark.oap_part4
def test_execute_jobs_create_trigger(self):
raise NotImplementedError # FIMXE: POST /jobs with 'status:create' and POST /jobs/{jobId}/results to trigger


@pytest.mark.functional
class WpsPackageAppWithS3BucketTest(WpsConfigBase, ResourcesUtil):
Expand Down
Loading

0 comments on commit 00771c7

Please sign in to comment.