|
1 | 1 | import json
|
| 2 | +import logging |
2 | 3 | import os
|
3 | 4 | from os import listdir
|
4 | 5 | from os.path import isfile, join
|
@@ -48,6 +49,10 @@ async def test_search_filters_post(app_client, ctx):
|
48 | 49 |
|
49 | 50 | for _filter in filters:
|
50 | 51 | resp = await app_client.post("/search", json={"filter": _filter})
|
| 52 | + if resp.status_code != 200: |
| 53 | + logging.error(f"Failed with status {resp.status_code}") |
| 54 | + logging.error(f"Response body: {resp.json()}") |
| 55 | + logging.error({"filter": _filter}) |
51 | 56 | assert resp.status_code == 200
|
52 | 57 |
|
53 | 58 |
|
@@ -431,3 +436,48 @@ async def test_search_filter_extension_between(app_client, ctx):
|
431 | 436 |
|
432 | 437 | assert resp.status_code == 200
|
433 | 438 | assert len(resp.json()["features"]) == 1
|
| 439 | + |
| 440 | + |
| 441 | +@pytest.mark.asyncio |
| 442 | +async def test_search_filter_extension_isnull_post(app_client, ctx): |
| 443 | + # Test for a property that is not null |
| 444 | + params = { |
| 445 | + "filter-lang": "cql2-json", |
| 446 | + "filter": { |
| 447 | + "op": "isNull", |
| 448 | + "args": [{"property": "properties.view:sun_elevation"}], |
| 449 | + }, |
| 450 | + } |
| 451 | + resp = await app_client.post("/search", json=params) |
| 452 | + |
| 453 | + assert resp.status_code == 200 |
| 454 | + assert len(resp.json()["features"]) == 0 |
| 455 | + |
| 456 | + # Test for the property that is null |
| 457 | + params = { |
| 458 | + "filter-lang": "cql2-json", |
| 459 | + "filter": { |
| 460 | + "op": "isNull", |
| 461 | + "args": [{"property": "properties.thispropertyisnull"}], |
| 462 | + }, |
| 463 | + } |
| 464 | + resp = await app_client.post("/search", json=params) |
| 465 | + |
| 466 | + assert resp.status_code == 200 |
| 467 | + assert len(resp.json()["features"]) == 1 |
| 468 | + |
| 469 | + |
| 470 | +@pytest.mark.asyncio |
| 471 | +async def test_search_filter_extension_isnull_get(app_client, ctx): |
| 472 | + # Test for a property that is not null |
| 473 | + |
| 474 | + resp = await app_client.get("/search?filter=properties.view:sun_elevation IS NULL") |
| 475 | + |
| 476 | + assert resp.status_code == 200 |
| 477 | + assert len(resp.json()["features"]) == 0 |
| 478 | + |
| 479 | + # Test for the property that is null |
| 480 | + resp = await app_client.get("/search?filter=properties.thispropertyisnull IS NULL") |
| 481 | + |
| 482 | + assert resp.status_code == 200 |
| 483 | + assert len(resp.json()["features"]) == 1 |
0 commit comments