From 3aac51c81f688c6e9a769742f856227830b4fcdc Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 6 Jun 2021 15:27:52 +0200 Subject: [PATCH] switch BDD tests to always use search API --- test/bdd/db/import/addressing.feature | 36 ++--- test/bdd/db/import/country.feature | 24 ++-- test/bdd/db/import/interpolation.feature | 8 +- test/bdd/db/import/linking.feature | 14 +- test/bdd/db/import/parenting.feature | 8 +- test/bdd/db/import/postcodes.feature | 8 +- test/bdd/db/import/search_name.feature | 174 +++++++++++------------ test/bdd/db/query/normalization.feature | 162 +++++++++++---------- test/bdd/db/query/search_simple.feature | 24 ++-- test/bdd/db/update/linked_places.feature | 32 +++-- test/bdd/db/update/naming.feature | 6 +- test/bdd/steps/http_responses.py | 7 +- test/bdd/steps/steps_api_queries.py | 23 --- 13 files changed, 260 insertions(+), 266 deletions(-) diff --git a/test/bdd/db/import/addressing.feature b/test/bdd/db/import/addressing.feature index 479ddd31..b6345baf 100644 --- a/test/bdd/db/import/addressing.feature +++ b/test/bdd/db/import/addressing.feature @@ -17,10 +17,10 @@ Feature: Address computation Then place_addressline doesn't contain | object | address | | N1 | N2 | - When searching for "Square" + When sending search query "Square" Then results contain - | osm_type | osm_id | name | - | N | 1 | Square, East Farm | + | osm | display_name | + | N1 | Square, East Farm | Scenario: given two place nodes, the closer one wins for the address Given the grid @@ -347,10 +347,10 @@ Feature: Address computation And place_addressline doesn't contain | object | address | | W1 | R1 | - When searching for "Bolder" + When sending search query "Bolder" Then results contain - | osm_type | osm_id | name | - | N | 1 | Bolder, Wonderway, Left | + | osm | display_name | + | N1 | Bolder, Wonderway, Left | Scenario: addr:* tags do not produce addresslines when the parent has the address part Given the grid @@ -371,10 +371,10 @@ Feature: Address computation And place_addressline doesn't contain | object | address | | N1 | R1 | - When searching for "Bolder" + When sending search query "Bolder" Then results contain - | osm_type | osm_id | name | - | N | 1 | Bolder, Wonderway, Outer | + | osm | display_name | + | N1 | Bolder, Wonderway, Outer | Scenario: addr:* tags on outside do not produce addresslines when the parent has the address part Given the grid @@ -397,10 +397,10 @@ Feature: Address computation And place_addressline doesn't contain | object | address | | N1 | R1 | - When searching for "Bolder" + When sending search query "Bolder" Then results contain - | osm_type | osm_id | name | - | N | 1 | Bolder, Wonderway, Left | + | osm | display_name | + | N1 | Bolder, Wonderway, Left | Scenario: POIs can correct address parts on the fly Given the grid @@ -425,11 +425,11 @@ Feature: Address computation | object | address | | N1 | R1 | | N2 | R2 | - When searching for "Bolder" + When sending search query "Bolder" Then results contain - | osm_type | osm_id | name | - | N | 1 | Bolder, Wonderway, Left | - When searching for "Leftside" + | osm | display_name | + | N1 | Bolder, Wonderway, Left | + When sending search query "Leftside" Then results contain - | osm_type | osm_id | name | - | N | 2 | Leftside, Wonderway, Right | + | osm | display_name | + | N2 | Leftside, Wonderway, Right | diff --git a/test/bdd/db/import/country.feature b/test/bdd/db/import/country.feature index 21f95e1f..354d5c2f 100644 --- a/test/bdd/db/import/country.feature +++ b/test/bdd/db/import/country.feature @@ -10,16 +10,16 @@ Feature: Country handling | osm | class | type | name | geometry | | N1 | place | town | Wenig | country:de | When importing - When searching for "Wenig, Loudou" + When sending search query "Wenig, Loudou" Then results contain - | osm_type | osm_id | name | - | N | 1 | Wenig, Deutschland | - When searching for "Wenig" + | osm | display_name | + | N1 | Wenig, Deutschland | + When sending search query "Wenig" | accept-language | | xy,en | Then results contain - | osm_type | osm_id | name | - | N | 1 | Wenig, Loudou | + | osm | display_name | + | N1 | Wenig, Loudou | Scenario: OSM country relations outside expected boundaries are ignored Given the places | osm | class | type | admin | name+name:xy | country | geometry | @@ -28,20 +28,20 @@ Feature: Country handling | osm | class | type | name | geometry | | N1 | place | town | Wenig | country:de | When importing - When searching for "Wenig" + When sending search query "Wenig" | accept-language | | xy,en | Then results contain - | osm_type | osm_id | name | - | N | 1 | Wenig, Germany | + | osm | display_name | + | N1 | Wenig, Germany | Scenario: Pre-defined country names are used Given the places | osm | class | type | name | geometry | | N1 | place | town | Ingb | country:ch | When importing - And searching for "Ingb" + And sending search query "Ingb" | accept-language | | en,de | Then results contain - | osm_type | osm_id | name | - | N | 1 | Ingb, Switzerland | + | osm | display_name | + | N1 | Ingb, Switzerland | diff --git a/test/bdd/db/import/interpolation.feature b/test/bdd/db/import/interpolation.feature index 52971295..181e87ee 100644 --- a/test/bdd/db/import/interpolation.feature +++ b/test/bdd/db/import/interpolation.feature @@ -240,11 +240,11 @@ Feature: Import of address interpolations Then W11 expands to interpolation | parent_place_id | start | end | | W3 | 12 | 16 | - When searching for "16 Cloud Street" + When sending search query "16 Cloud Street" Then results contain | ID | osm_type | osm_id | | 0 | N | 4 | - When searching for "14 Cloud Street" + When sending search query "14 Cloud Street" Then results contain | ID | osm_type | osm_id | | 0 | W | 11 | @@ -282,11 +282,11 @@ Feature: Import of address interpolations Then W11 expands to interpolation | parent_place_id | start | end | | W3 | 12 | 16 | - When searching for "16 Cloud Street" + When sending search query "16 Cloud Street" Then results contain | ID | osm_type | osm_id | | 0 | N | 4 | - When searching for "14 Cloud Street" + When sending search query "14 Cloud Street" Then results contain | ID | osm_type | osm_id | | 0 | W | 11 | diff --git a/test/bdd/db/import/linking.feature b/test/bdd/db/import/linking.feature index e2696e63..915c13b3 100644 --- a/test/bdd/db/import/linking.feature +++ b/test/bdd/db/import/linking.feature @@ -47,7 +47,7 @@ Feature: Linking of places | W2 | R13 | | R13 | - | | R23 | - | - When searching for "rhein" + When sending search query "rhein" Then results contain | osm_type | | R | @@ -98,7 +98,7 @@ Feature: Linking of places | object | linked_place_id | | W1 | - | | R1 | - | - When searching for "rhein" + When sending search query "rhein" Then results contain | ID | osm_type | | 0 | R | @@ -119,7 +119,7 @@ Feature: Linking of places | object | linked_place_id | | W1 | - | | W2 | R1 | - When searching for "rhein2" + When sending search query "rhein2" Then results contain | osm_type | | W | @@ -172,13 +172,13 @@ Feature: Linking of places And placex contains | object | rank_address | | R13 | 16 | - When searching for "" + When sending search query "" | city | | Berlin | Then results contain | ID | osm_type | osm_id | | 0 | R | 13 | - When searching for "" + When sending search query "" | state | | Berlin | Then results contain @@ -200,13 +200,13 @@ Feature: Linking of places And placex contains | object | rank_address | | R13 | 8 | - When searching for "" + When sending search query "" | state | | Berlin | Then results contain | ID | osm_type | osm_id | | 0 | R | 13 | - When searching for "" + When sending search query "" | city | | Berlin | Then results contain diff --git a/test/bdd/db/import/parenting.feature b/test/bdd/db/import/parenting.feature index 62d65cef..b5210f94 100644 --- a/test/bdd/db/import/parenting.feature +++ b/test/bdd/db/import/parenting.feature @@ -18,13 +18,13 @@ Feature: Parenting of objects | object | parent_place_id | | N1 | W1 | | N2 | W1 | - When searching for "4 galoo" + When sending search query "4 galoo" Then results contain - | ID | osm_type | osm_id | langaddress | + | ID | osm_type | osm_id | display_name | | 0 | N | 1 | 4, galoo, 12345 | - When searching for "5 galoo" + When sending search query "5 galoo" Then results contain - | ID | osm_type | osm_id | langaddress | + | ID | osm_type | osm_id | display_name | | 0 | N | 2 | 5, galoo, 99999 | Scenario: Address without tags, closest street diff --git a/test/bdd/db/import/postcodes.feature b/test/bdd/db/import/postcodes.feature index 3d1dc489..6102e99b 100644 --- a/test/bdd/db/import/postcodes.feature +++ b/test/bdd/db/import/postcodes.feature @@ -148,11 +148,11 @@ Feature: Import of postcodes | country | postcode | geometry | | gb | EH4 7EA | country:gb | | gb | E4 7EA | country:gb | - When searching for "EH4 7EA" + When sending search query "EH4 7EA" Then results contain - | type | placename | + | type | display_name | | postcode | EH4 7EA | - When searching for "E4 7EA" + When sending search query "E4 7EA" Then results contain - | type | placename | + | type | display_name | | postcode | E4 7EA | diff --git a/test/bdd/db/import/search_name.feature b/test/bdd/db/import/search_name.feature index 9e899053..d393b8f3 100644 --- a/test/bdd/db/import/search_name.feature +++ b/test/bdd/db/import/search_name.feature @@ -48,18 +48,18 @@ Feature: Creation of search terms Then search_name contains | object | nameaddress_vector | | N1 | #Rose Street, Walltown | - When searching for "23 Rose Street, Walltown" + When sending search query "23 Rose Street, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "Walltown, Rose Street 23" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "Walltown, Rose Street 23" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "Rose Street 23, Walltown" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "Rose Street 23, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | + | osm | display_name | + | N1 | 23, Rose Street | Scenario: Searching for unknown addr: tags also works for multiple words Given the scene roads-with-pois @@ -73,18 +73,18 @@ Feature: Creation of search terms Then search_name contains | object | nameaddress_vector | | N1 | #Rose Street, rose, Little, Big, Town | - When searching for "23 Rose Street, Little Big Town" + When sending search query "23 Rose Street, Little Big Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "Rose Street 23, Little Big Town" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "Rose Street 23, Little Big Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "Little big Town, Rose Street 23" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "Little big Town, Rose Street 23" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | + | osm | display_name | + | N1 | 23, Rose Street | Scenario: Unnamed POI has no search entry when it has known addr: tags Given the scene roads-with-pois @@ -96,10 +96,10 @@ Feature: Creation of search terms | W1 | highway | residential | Rose Street | Walltown | :w-north | When importing Then search_name has no entry for N1 - When searching for "23 Rose Street, Walltown" + When sending search query "23 Rose Street, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | + | osm | display_name | + | N1 | 23, Rose Street | Scenario: Unnamed POI must have a house number to get a search entry Given the scene roads-with-pois @@ -128,23 +128,23 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Walltown | Strange, Town | - When searching for "23 Rose Street" + When sending search query "23 Rose Street" Then exactly 1 results are returned And results contain - | osm_type | osm_id | name | - | W | 1 | Rose Street, Strange Town | - When searching for "23 Walltown, Strange Town" + | osm | display_name | + | W1 | Rose Street, Strange Town | + When sending search query "23 Walltown, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Walltown, Strange Town | - When searching for "Walltown 23, Strange Town" + | osm | display_name | + | N1 | 23, Walltown, Strange Town | + When sending search query "Walltown 23, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Walltown, Strange Town | - When searching for "Strange Town, Walltown 23" + | osm | display_name | + | N1 | 23, Walltown, Strange Town | + When sending search query "Strange Town, Walltown 23" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Walltown, Strange Town | + | osm | display_name | + | N1 | 23, Walltown, Strange Town | Scenario: Named POIs can be searched by housenumber when unknown addr:place is present Given the scene roads-with-pois @@ -159,26 +159,26 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Walltown, #Blue house | Walltown, Strange, Town | - When searching for "23 Walltown, Strange Town" + When sending search query "23 Walltown, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Walltown, Strange Town | - When searching for "Walltown 23, Strange Town" + | osm | display_name | + | N1 | Blue house, 23, Walltown, Strange Town | + When sending search query "Walltown 23, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Walltown, Strange Town | - When searching for "Strange Town, Walltown 23" + | osm | display_name | + | N1 | Blue house, 23, Walltown, Strange Town | + When sending search query "Strange Town, Walltown 23" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Walltown, Strange Town | - When searching for "Strange Town, Walltown 23, Blue house" + | osm | display_name | + | N1 | Blue house, 23, Walltown, Strange Town | + When sending search query "Strange Town, Walltown 23, Blue house" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Walltown, Strange Town | - When searching for "Strange Town, Walltown, Blue house" + | osm | display_name | + | N1 | Blue house, 23, Walltown, Strange Town | + When sending search query "Strange Town, Walltown, Blue house" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Walltown, Strange Town | + | osm | display_name | + | N1 | Blue house, 23, Walltown, Strange Town | Scenario: Named POIs can be found when unknown multi-word addr:place is present Given the scene roads-with-pois @@ -193,14 +193,14 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Moon sun, #Blue house | Moon, Sun, Strange, Town | - When searching for "23 Moon Sun, Strange Town" + When sending search query "23 Moon Sun, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Moon sun, Strange Town | - When searching for "Blue house, Moon Sun, Strange Town" + | osm | display_name | + | N1 | Blue house, 23, Moon sun, Strange Town | + When sending search query "Blue house, Moon Sun, Strange Town" Then results contain - | osm_type | osm_id | name | - | N | 1 | Blue house, 23, Moon sun, Strange Town | + | osm | display_name | + | N1 | Blue house, 23, Moon sun, Strange Town | Scenario: Unnamed POIs doesn't inherit parent name when addr:place is present only in parent address Given the scene roads-with-pois @@ -215,16 +215,16 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Walltown | Strange, Town | - When searching for "23 Rose Street, Walltown" + When sending search query "23 Rose Street, Walltown" Then exactly 1 result is returned And results contain - | osm_type | osm_id | name | - | W | 1 | Rose Street, Strange Town | - When searching for "23 Walltown" + | osm | display_name | + | W1 | Rose Street, Strange Town | + When sending search query "23 Walltown" Then exactly 1 result is returned And results contain - | osm_type | osm_id | name | - | N | 1 | 23, Walltown, Strange Town | + | osm | display_name | + | N1 | 23, Walltown, Strange Town | Scenario: Unnamed POIs does inherit parent name when unknown addr:place and addr:street is present Given the scene roads-with-pois @@ -236,11 +236,11 @@ Feature: Creation of search terms | W1 | highway | residential | Rose Street | :w-north | When importing Then search_name has no entry for N1 - When searching for "23 Rose Street" + When sending search query "23 Rose Street" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "23 Lily Street" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "23 Lily Street" Then exactly 0 results are returned Scenario: An unknown addr:street is ignored @@ -253,11 +253,11 @@ Feature: Creation of search terms | W1 | highway | residential | Rose Street | :w-north | When importing Then search_name has no entry for N1 - When searching for "23 Rose Street" + When sending search query "23 Rose Street" Then results contain - | osm_type | osm_id | name | - | N | 1 | 23, Rose Street | - When searching for "23 Lily Street" + | osm | display_name | + | N1 | 23, Rose Street | + When sending search query "23 Lily Street" Then exactly 0 results are returned Scenario: Named POIs get unknown address tags added in the search_name table @@ -272,26 +272,26 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Green Moss | #Rose Street, Walltown | - When searching for "Green Moss, Rose Street, Walltown" + When sending search query "Green Moss, Rose Street, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, 26, Rose Street | - When searching for "Green Moss, 26, Rose Street, Walltown" + | osm | display_name | + | N1 | Green Moss, 26, Rose Street | + When sending search query "Green Moss, 26, Rose Street, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, 26, Rose Street | - When searching for "26, Rose Street, Walltown" + | osm | display_name | + | N1 | Green Moss, 26, Rose Street | + When sending search query "26, Rose Street, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, 26, Rose Street | - When searching for "Rose Street 26, Walltown" + | osm | display_name | + | N1 | Green Moss, 26, Rose Street | + When sending search query "Rose Street 26, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, 26, Rose Street | - When searching for "Walltown, Rose Street 26" + | osm | display_name | + | N1 | Green Moss, 26, Rose Street | + When sending search query "Walltown, Rose Street 26" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, 26, Rose Street | + | osm | display_name | + | N1 | Green Moss, 26, Rose Street | Scenario: Named POI doesn't inherit parent name when addr:place is present only in parent address Given the scene roads-with-pois @@ -306,12 +306,12 @@ Feature: Creation of search terms Then search_name contains | object | name_vector | nameaddress_vector | | N1 | #Green Moss | Walltown | - When searching for "Green Moss, Rose Street, Walltown" + When sending search query "Green Moss, Rose Street, Walltown" Then exactly 0 result is returned - When searching for "Green Moss, Walltown" + When sending search query "Green Moss, Walltown" Then results contain - | osm_type | osm_id | name | - | N | 1 | Green Moss, Walltown, Strange Town | + | osm | display_name | + | N1 | Green Moss, Walltown, Strange Town | Scenario: Named POIs inherit address from parent Given the scene roads-with-pois diff --git a/test/bdd/db/query/normalization.feature b/test/bdd/db/query/normalization.feature index 8a324a22..35045589 100644 --- a/test/bdd/db/query/normalization.feature +++ b/test/bdd/db/query/normalization.feature @@ -11,44 +11,44 @@ Feature: Import and search of names Then placex contains | object | class | type | name+name | | N1 | place | locality | FooBar | - When searching for "FooBar" + When sending search query "FooBar" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "foobar" + | ID | osm | + | 0 | N1 | + When sending search query "foobar" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "fOObar" + | ID | osm | + | 0 | N1 | + When sending search query "fOObar" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "FOOBAR" + | ID | osm | + | 0 | N1 | + When sending search query "FOOBAR" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | + | ID | osm | + | 0 | N1 | Scenario: Multiple spaces in name Given the places | osm | class | type | name | | N1 | place | locality | one two three | When importing - When searching for "one two three" + When sending search query "one two three" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "one two three" + | ID | osm | + | 0 | N1 | + When sending search query "one two three" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "one two three" + | ID | osm | + | 0 | N1 | + When sending search query "one two three" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for " one two three" + | ID | osm | + | 0 | N1 | + When sending search query " one two three" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | + | ID | osm | + | 0 | N1 | Scenario: Special characters in name Given the places @@ -59,58 +59,58 @@ Feature: Import and search of names | N4 | place | locality | space | | N5 | place | locality | mountain | When importing - When searching for "Jim-Knopf-Str" + When sending search query "Jim-Knopf-Str" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "Jim Knopf-Str" + | ID | osm | + | 0 | N1 | + When sending search query "Jim Knopf-Str" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "Jim Knopf Str" + | ID | osm | + | 0 | N1 | + When sending search query "Jim Knopf Str" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "Jim/Knopf-Str" + | ID | osm | + | 0 | N1 | + When sending search query "Jim/Knopf-Str" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "Jim-Knopfstr" + | ID | osm | + | 0 | N1 | + When sending search query "Jim-Knopfstr" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 1 | - When searching for "Smith/Weston" + | ID | osm | + | 0 | N1 | + When sending search query "Smith/Weston" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 2 | - When searching for "Smith Weston" + | ID | osm | + | 0 | N2 | + When sending search query "Smith Weston" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 2 | - When searching for "Smith-Weston" + | ID | osm | + | 0 | N2 | + When sending search query "Smith-Weston" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 2 | - When searching for "space mountain" + | ID | osm | + | 0 | N2 | + When sending search query "space mountain" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 3 | - When searching for "space-mountain" + | ID | osm | + | 0 | N3 | + When sending search query "space-mountain" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 3 | - When searching for "space/mountain" + | ID | osm | + | 0 | N3 | + When sending search query "space/mountain" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 3 | - When searching for "space\mountain" + | ID | osm | + | 0 | N3 | + When sending search query "space\mountain" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 3 | - When searching for "space(mountain)" + | ID | osm | + | 0 | N3 | + When sending search query "space(mountain)" Then results contain - | ID | osm_type | osm_id | - | 0 | N | 3 | + | ID | osm | + | 0 | N3 | Scenario: Landuse with name are found Given the places @@ -118,34 +118,32 @@ Feature: Import and search of names | R1 | natural | meadow | landuse1 | (0 0, 1 0, 1 1, 0 1, 0 0) | | R2 | landuse | industrial | landuse2 | (0 0, -1 0, -1 -1, 0 -1, 0 0) | When importing - When searching for "landuse1" + When sending search query "landuse1" Then results contain - | ID | osm_type | osm_id | - | 0 | R | 1 | - When searching for "landuse2" + | ID | osm | + | 0 | R1 | + When sending search query "landuse2" Then results contain - | ID | osm_type | osm_id | - | 0 | R | 2 | + | ID | osm | + | 0 | R2 | Scenario: Postcode boundaries without ref Given the places | osm | class | type | postcode | geometry | | R1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0) | When importing - When searching for "12345" + When sending search query "12345" Then results contain - | ID | osm_type | osm_id | - | 0 | R | 1 | + | ID | osm | + | 0 | R1 | Scenario: Unprintable characters in postcodes are ignored Given the named places | osm | class | type | address | | N234 | amenity | prison | 'postcode' : u'1234\u200e' | When importing - And searching for "1234" - Then results contain - | ID | osm_type | - | 0 | P | + And sending search query "1234" + Then result 0 has not attributes osm_type Scenario Outline: Housenumbers with special characters are found Given the grid @@ -158,10 +156,10 @@ Feature: Import and search of names | osm | class | type | housenr | geometry | | N1 | building | yes | | 9 | When importing - And searching for "Main St " + And sending search query "Main St " Then results contain - | osm_type | osm_id | name | - | N | 1 | , Main St | + | osm | display_name | + | N1 | , Main St | Examples: | nr | @@ -186,10 +184,10 @@ Feature: Import and search of names | osm | class | type | housenr | geometry | | N1 | building | yes | | 9 | When importing - And searching for "Main St " + And sending search query "Main St " Then results contain - | osm_type | osm_id | name | - | N | 1 | , Main St | + | osm | display_name | + | N1 | , Main St | Examples: | nr-list | nr | diff --git a/test/bdd/db/query/search_simple.feature b/test/bdd/db/query/search_simple.feature index daf83cea..7f141c4c 100644 --- a/test/bdd/db/query/search_simple.feature +++ b/test/bdd/db/query/search_simple.feature @@ -7,31 +7,29 @@ Feature: Searching of simple objects | osm | class | type | name+name | geometry | | N1 | place | village | Foo | 10.0 -10.0 | When importing - And searching for "Foo" + And sending search query "Foo" Then results contain - | ID | osm | class | type | centroid | - | 0 | N1 | place | village | 10 -10 | + | ID | osm | category | type | centroid | + | 0 | N1 | place | village | 10 -10 | Scenario: Updating postcode in postcode boundaries without ref Given the places | osm | class | type | postcode | geometry | | R1 | boundary | postal_code | 12345 | poly-area:1.0 | When importing - And searching for "12345" + And sending search query "12345" Then results contain - | ID | osm_type | osm_id | - | 0 | R | 1 | + | ID | osm | + | 0 | R1 | When updating places | osm | class | type | postcode | geometry | | R1 | boundary | postal_code | 54321 | poly-area:1.0 | - And searching for "12345" + And sending search query "12345" + Then result 0 has not attributes osm_type + When sending search query "54321" Then results contain - | osm_type | - | P | - When searching for "54321" - Then results contain - | ID | osm_type | osm_id | - | 0 | R | 1 | + | ID | osm | + | 0 | R1 | # github #1763 Scenario: Correct translation of highways under construction diff --git a/test/bdd/db/update/linked_places.feature b/test/bdd/db/update/linked_places.feature index 42e62de5..7a0fa21a 100644 --- a/test/bdd/db/update/linked_places.feature +++ b/test/bdd/db/update/linked_places.feature @@ -10,7 +10,9 @@ Feature: Updates of linked places | osm | class | type | name | admin | geometry | | R1 | boundary | administrative | foo | 8 | poly-area:0.1 | When importing - And searching for "foo" with dups + And sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | R | @@ -20,7 +22,9 @@ Feature: Updates of linked places Then placex contains | object | linked_place_id | | N1 | - | - When searching for "foo" with dups + When sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | N | @@ -33,7 +37,9 @@ Feature: Updates of linked places | osm | class | type | name | admin | geometry | | R1 | boundary | administrative | foo | 8 | poly-area:0.1 | When importing - And searching for "foo" with dups + And sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | R | @@ -41,7 +47,9 @@ Feature: Updates of linked places Then placex contains | object | linked_place_id | | N1 | - | - When searching for "foo" with dups + When sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | N | @@ -51,7 +59,9 @@ Feature: Updates of linked places | osm | class | type | name | geometry | | N1 | place | city | foo | 0 0 | When importing - And searching for "foo" with dups + And sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | N | @@ -61,7 +71,9 @@ Feature: Updates of linked places Then placex contains | object | linked_place_id | | N1 | R1 | - When searching for "foo" with dups + When sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | R | @@ -74,7 +86,9 @@ Feature: Updates of linked places | osm | class | type | name | admin | geometry | | R1 | boundary | administrative | foobar | 8 | poly-area:0.1 | When importing - And searching for "foo" with dups + And sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | N | @@ -84,7 +98,9 @@ Feature: Updates of linked places Then placex contains | object | linked_place_id | | N1 | R1 | - When searching for "foo" with dups + When sending search query "foo" + | dups | + | 1 | Then results contain | osm_type | | R | diff --git a/test/bdd/db/update/naming.feature b/test/bdd/db/update/naming.feature index 4b5222fc..4023e3f9 100644 --- a/test/bdd/db/update/naming.feature +++ b/test/bdd/db/update/naming.feature @@ -7,10 +7,10 @@ Feature: Update of names in place objects | osm | class | type | postcode | geometry | | R1 | boundary | postal_code | 12345 | poly-area:0.5 | When importing - And searching for "12345" + And sending search query "12345" Then results contain - | ID | osm_type | osm_id | - | 0 | R | 1 | + | ID | osm | + | 0 | R1 | When updating places | osm | class | type | geometry | | R1 | boundary | postal_code | poly-area:0.5 | diff --git a/test/bdd/steps/http_responses.py b/test/bdd/steps/http_responses.py index 247a397b..0920a7e2 100644 --- a/test/bdd/steps/http_responses.py +++ b/test/bdd/steps/http_responses.py @@ -8,7 +8,9 @@ import xml.etree.ElementTree as ET from check_functions import Almost -OSM_TYPE = {'N' : 'node', 'W' : 'way', 'R' : 'relation'} +OSM_TYPE = {'N' : 'node', 'W' : 'way', 'R' : 'relation', + 'n' : 'node', 'w' : 'way', 'r' : 'relation', + 'node' : 'n', 'way' : 'w', 'relation' : 'r'} def _geojson_result_to_json_result(geojson_result): result = geojson_result['properties'] @@ -139,6 +141,9 @@ class GenericResponse: assert self.result[i]['osm_type'] in (OSM_TYPE[value[0]], value[0]), \ BadRowValueAssert(self, i, 'osm_type', value) self.assert_field(i, 'osm_id', value[1:]) + elif name == 'osm_type': + assert self.result[i]['osm_type'] in (OSM_TYPE[value[0]], value[0]), \ + BadRowValueAssert(self, i, 'osm_type', value) elif name == 'centroid': lon, lat = value.split(' ') self.assert_field(i, 'lat', float(lat)) diff --git a/test/bdd/steps/steps_api_queries.py b/test/bdd/steps/steps_api_queries.py index 1b3da08b..fc0a2156 100644 --- a/test/bdd/steps/steps_api_queries.py +++ b/test/bdd/steps/steps_api_queries.py @@ -55,29 +55,6 @@ def compare(operator, op1, op2): raise Exception("unknown operator '%s'" % operator) -@when(u'searching for "(?P.*)"(?P with dups)?') -def query_cmd(context, query, dups): - """ Query directly via PHP script. - """ - cmd = ['/usr/bin/env', 'php'] - cmd.append(context.nominatim.src_dir / 'lib-php' / 'admin' / 'query.php') - if query: - cmd.extend(['--search', query]) - # add more parameters in table form - if context.table: - for h in context.table.headings: - value = context.table[0][h].strip() - if value: - cmd.extend(('--' + h, value)) - - if dups: - cmd.extend(('--dedupe', '0')) - - outp, err = run_script(cmd, cwd=context.nominatim.website_dir.name, - env=context.nominatim.test_env) - - context.response = SearchResponse(outp, 'json') - def send_api_query(endpoint, params, fmt, context): if fmt is not None and fmt.strip() != 'debug': params['format'] = fmt.strip() -- 2.39.5