Files
qdrant/tests/openapi/test_validate_schema.py
Predrag Knezevic 96a5a2bce8 Test collections unique per openapi test module (#5384)
Collection name under test is equal to the test module name, without `.py` suffix.

* Helps by debugging/tracing failed tests and find relevant logs lines in qdrant log files
* Opens up a possibility to run tests in parallel, given that there are no data sharing
  between test modules

Change details:
* defined module scoped `collection_name` fixture in `conftest.py`
* removed `collection_name` module variable
* each test signature modified to declare the dependency to `collection_name` fixture
* `@pytest.mark.parametrize` migrated to `@pytest-cases.parametrize` in cases when
  `collection_name` was used as the value
2024-11-08 11:27:05 +01:00

33 lines
1010 B
Python

from .helpers.helpers import request_with_validation
# validate that malformed conditions raise a JsonSchema ValidationError
def test_malformed_condition(collection_name):
# Should raise a ValidationError because the condition key is not defined
# see https://github.com/qdrant/qdrant/issues/1664
# with pytest.raises(jsonschema.exceptions.ValidationError):
malformed_condition(collection_name)
def malformed_condition(collection_name):
request_with_validation(
api='/collections/{collection_name}/points/search',
method="POST",
path_params={'collection_name': collection_name},
body={
"vector": [0.2, 0.1, 0.9, 0.7],
"limit": 5,
"filter": {
"should": [
{
"undefined_condition_key": {
"key": "city"
}
}
]
},
"with_payload": True
}
)