diff --git a/oarepo_model_builder_tests/templates/test_resource.py.jinja2 b/oarepo_model_builder_tests/templates/test_resource.py.jinja2 index e841fb1..3cec9cc 100644 --- a/oarepo_model_builder_tests/templates/test_resource.py.jinja2 +++ b/oarepo_model_builder_tests/templates/test_resource.py.jinja2 @@ -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"]) @@ -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 diff --git a/oarepo_model_builder_tests/templates/test_service.py.jinja2 b/oarepo_model_builder_tests/templates/test_service.py.jinja2 index 3c7acdd..341bc2b 100644 --- a/oarepo_model_builder_tests/templates/test_service.py.jinja2 +++ b/oarepo_model_builder_tests/templates/test_service.py.jinja2 @@ -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 ): @@ -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 ) diff --git a/setup.cfg b/setup.cfg index 8e12712..566ca7e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-model-builder-tests -version = 4.0.6 +version = 4.0.7 description = authors = Ronald Krist readme = README.md diff --git a/tests/model/model_app.yaml b/tests/model/model_app.yaml index 2832e6f..4b0b3bc 100644 --- a/tests/model/model_app.yaml +++ b/tests/model/model_app.yaml @@ -6,8 +6,6 @@ record: type: fulltext whateverkeyword: type: keyword - whateverboth: - type: fulltext+keyword use: - invenio module: