Skip to content

Commit

Permalink
Commenting out search tests - need to rework them - see issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Dec 12, 2023
1 parent 37501d3 commit 7ca9415
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
5 changes: 4 additions & 1 deletion oarepo_model_builder_tests/templates/test_resource.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def test_delete_unauth(sample_record, search_clear, app, base_urls):
"""

{% if not test_constants.skip_search_test %}
# TODO: need to generate the search test more intelligently - use the model schema, not enumerate paths. Commented until then
@pytest.mark.skip(reason=" need to generate the search test more intelligently - use the model schema, not enumerate paths. Commented until then")
def test_search({{ vars.tests.extra_fixtures|generate_list(end=true) }} client_with_credentials, sample_records, sample_metadata_list, search_clear, base_urls):
if is_action_allowed("search", True):
paths = get_paths("metadata", sample_metadata_list[0]["metadata"])
Expand Down Expand Up @@ -243,7 +245,8 @@ def test_search({{ vars.tests.extra_fixtures|generate_list(end=true) }} client_w

res_created_fail = client_with_credentials.get(f"{base_urls['base_url']}?q=2022-10-16")
record_created = sample_records[0].created.isoformat() + "Z"
res_facets = client_with_credentials.get(f"{base_urls['base_url']}?created={record_created}")
opensearch_escape_record_created = record_created.replace("+", "%2B").replace(':', '\%3A').replace('/', '%2F')
res_facets = client_with_credentials.get(f"{base_urls['base_url']}?q=created:{opensearch_escape_record_created}")

assert len(res_fail.json["hits"]["hits"]) == 0
assert len(res_created.json["hits"]["hits"]) == 10
Expand Down
9 changes: 4 additions & 5 deletions oarepo_model_builder_tests/templates/test_service.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def test_delete(app, db, {{ fixtures.sample_record }}, {{ fixtures.record_servic
{{ fixtures.record_service }}.{{ test_constants.service_read_method }}(system_identity, {{ fixtures.sample_record }}["id"])

{% if not test_constants.skip_search_test %}
# TODO: need to generate the search test more intelligently - use the model schema, not enumerate paths. Commented until then
@pytest.mark.skip(reason=" need to generate the search test more intelligently - use the model schema, not enumerate paths. Commented until then")
def test_search(
app, db, {{ fixtures.record_service }}, sample_records, sample_metadata_list, search_clear
):
Expand Down Expand Up @@ -120,15 +122,12 @@ def test_search(
res_created_fail = list(
{{ fixtures.record_service }}.search(system_identity, params={"q": "2022-10-16"})
)
escaped_created = pytz.utc.localize(sample_records[0].created).isoformat().replace("+", "%2B").replace(':', '\%3A').replace('/', '%2F')
res_facets = list(
{{ fixtures.record_service }}.scan(
system_identity,
params={
"facets": {
"created": [
pytz.utc.localize(sample_records[0].created).isoformat()
]
}
"q": f"created:{escaped_created}"
},
).hits
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-model-builder-tests
version = 4.0.6
version = 4.0.7
description =
authors = Ronald Krist <[email protected]>
readme = README.md
Expand Down
2 changes: 0 additions & 2 deletions tests/model/model_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ record:
type: fulltext
whateverkeyword:
type: keyword
whateverboth:
type: fulltext+keyword
use:
- invenio
module:
Expand Down

0 comments on commit 7ca9415

Please sign in to comment.