Add test for combined q in spatial field
This commit is contained in:
parent
ec0cc00bbe
commit
03ad3ef31c
|
@ -692,6 +692,33 @@ class TestSpatialFieldSearch(SpatialTestBase):
|
|||
|
||||
assert result["count"] == 0
|
||||
|
||||
def test_spatial_search_combined_with_other_q(self):
|
||||
dataset_extents = [
|
||||
("Dataset A", (0, 1, 1, 2), "rabbit"),
|
||||
("Dataset B", (1, 1, 2, 2), "rabbit"),
|
||||
("Dataset C", (0, 0, 1, 1), "mole"),
|
||||
("Dataset D", (1, 0, 2, 1), "badger"),
|
||||
]
|
||||
|
||||
for item in dataset_extents:
|
||||
geom = """
|
||||
{{"type":"Polygon",
|
||||
"coordinates":[[[{xmin},{ymax}],[{xmin},{ymin}],[{xmax},{ymin}],[{xmax},{ymax}],[{xmin},{ymax}]]]}}
|
||||
""".format(
|
||||
xmin=item[1][0], ymin=item[1][1], xmax=item[1][2], ymax=item[1][3])
|
||||
factories.Dataset(
|
||||
title=item[0],
|
||||
notes=item[2],
|
||||
extras=[{"key": "spatial", "value": geom}]
|
||||
|
||||
)
|
||||
|
||||
result = helpers.call_action(
|
||||
"package_search", q="rabbit", extras={"ext_bbox": "0.75,0.75,1.75,1.75"}
|
||||
)
|
||||
|
||||
assert result["count"] == 2
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("clean_db", "clean_index", "harvest_setup", "with_plugins")
|
||||
@pytest.mark.ckan_config(
|
||||
|
|
Loading…
Reference in New Issue