add BDD tests for DB

This commit is contained in:
Sarah Hoffmann
2025-04-09 14:52:34 +02:00
parent 5f44aa2873
commit b34991d85f
33 changed files with 6095 additions and 46 deletions

View File

@@ -0,0 +1,108 @@
Feature: Country handling
Tests for update of country information
Background:
Given the 1.0 grid with origin DE
| 1 | | 2 |
| | 10 | |
| 4 | | 3 |
Scenario: When country names are changed old ones are no longer searchable
Given the places
| osm | class | type | admin | name+name:xy | country | geometry |
| R1 | boundary | administrative | 2 | Loudou | de | (1,2,3,4,1) |
Given the places
| osm | class | type | name |
| N10 | place | town | Wenig |
When importing
When geocoding "Wenig, Loudou"
Then all results contain
| object |
| N10 |
When updating places
| osm | class | type | admin | name+name:xy | country | geometry |
| R1 | boundary | administrative | 2 | Germany | de | (1,2,3,4,1) |
When geocoding "Wenig, Loudou"
Then exactly 0 results are returned
Scenario: When country names are deleted they are no longer searchable
Given the places
| osm | class | type | admin | name+name:xy | country | geometry |
| R1 | boundary | administrative | 2 | Loudou | de | (1,2,3,4,1) |
Given the places
| osm | class | type | name |
| N10 | place | town | Wenig |
When importing
When geocoding "Wenig, Loudou"
Then all results contain
| object |
| N10 |
When updating places
| osm | class | type | admin | name+name:en | country | geometry |
| R1 | boundary | administrative | 2 | Germany | de | (1,2,3,4,1) |
When geocoding "Wenig, Loudou"
Then exactly 0 results are returned
When geocoding "Wenig"
| accept-language |
| xy,en |
Then all results contain
| object | display_name |
| N10 | Wenig, Germany |
Scenario: Default country names are always searchable
Given the places
| osm | class | type | name |
| N10 | place | town | Wenig |
When importing
When geocoding "Wenig, Germany"
Then all results contain
| object |
| N10 |
When geocoding "Wenig, de"
Then all results contain
| object |
| N10 |
When updating places
| osm | class | type | admin | name+name:en | country | geometry |
| R1 | boundary | administrative | 2 | Lilly | de | (1,2,3,4,1) |
When geocoding "Wenig, Germany"
| accept-language |
| en,de |
Then all results contain
| object | display_name |
| N10 | Wenig, Lilly |
When geocoding "Wenig, de"
| accept-language |
| en,de |
Then all results contain
| object | display_name |
| N10 | Wenig, Lilly |
Scenario: When a localised name is deleted, the standard name takes over
Given the places
| osm | class | type | admin | name+name:de | country | geometry |
| R1 | boundary | administrative | 2 | Loudou | de | (1,2,3,4,1) |
Given the places
| osm | class | type | name |
| N10 | place | town | Wenig |
When importing
When geocoding "Wenig, Loudou"
| accept-language |
| de,en |
Then all results contain
| object | display_name |
| N10 | Wenig, Loudou |
When updating places
| osm | class | type | admin | name+name:en | country | geometry |
| R1 | boundary | administrative | 2 | Germany | de | (1,2,3,4,1) |
When geocoding "Wenig, Loudou"
Then exactly 0 results are returned
When geocoding "Wenig"
| accept-language |
| de,en |
Then all results contain
| object | display_name |
| N10 | Wenig, Deutschland |

View File

@@ -0,0 +1,418 @@
Feature: Update of address interpolations
Test the interpolated address are updated correctly
Scenario: new interpolation added to existing street
Given the grid
| 10 | | | | 11 |
| | 1 | 99 | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
| W3 | highway | unclassified | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then W10 expands to no interpolation
When updating places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And updating places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | 1,2 |
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end | geometry |
| W2 | 4 | 4 | 99 |
Scenario: addr:street added to interpolation
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
| W3 | highway | unclassified | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
When updating places
| osm | class | type | addr+interpolation | street | geometry |
| W10 | place | houses | even | Cloud Street | 1,2 |
Then placex contains
| object | parent_place_id |
| N1 | W3 |
| N2 | W3 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W3 | 4 | 4 |
Scenario: addr:street added to housenumbers
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
| W3 | highway | unclassified | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
When updating places
| osm | class | type | street | housenr |
| N1 | place | house | Cloud Street| 2 |
| N2 | place | house | Cloud Street| 6 |
Then placex contains
| object | parent_place_id |
| N1 | W3 |
| N2 | W3 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W3 | 4 | 4 |
Scenario: interpolation tag removed
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W10 | place | houses | even | 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
| W3 | highway | unclassified | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
When marking for delete W10
Then W10 expands to no interpolation
And placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
Scenario: referenced road added
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | street | geometry |
| W10 | place | houses | even | Cloud Street| 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
When updating places
| osm | class | type | name | geometry |
| W3 | highway | unclassified | Cloud Street | 20,21 |
Then placex contains
| object | parent_place_id |
| N1 | W3 |
| N2 | W3 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W3 | 4 | 4 |
Scenario: referenced road deleted
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | | | | |
| 20 | | | | 21 |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | addr+interpolation | street | geometry |
| W10 | place | houses | even | Cloud Street| 1,2 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Sun Way | 10,11 |
| W3 | highway | unclassified | Cloud Street | 20,21 |
And the ways
| id | nodes |
| 10 | 1,2 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W3 |
| N2 | W3 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W3 | 4 | 4 |
When marking for delete W3
Then placex contains
| object | parent_place_id |
| N1 | W2 |
| N2 | W2 |
And W10 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
Scenario: building becomes interpolation
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | 4 | | 3 | |
And the places
| osm | class | type | housenr | geometry |
| W1 | place | house | 3 | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Cloud Street | 10,11 |
When importing
Then placex contains
| object | parent_place_id |
| W1 | W2 |
Given the ways
| id | nodes |
| 1 | 1,2 |
When updating places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And updating places
| osm | class | type | addr+interpolation | street | geometry |
| W1 | place | houses | even | Cloud Street| 1,2 |
Then placex has no entry for W1
And W1 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
Scenario: interpolation becomes building
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
| | 4 | | 3 | |
And the places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Cloud Street | 10,11 |
And the ways
| id | nodes |
| 1 | 1,2 |
And the places
| osm | class | type | addr+interpolation | street | geometry |
| W1 | place | houses | even | Cloud Street| 1,2 |
When importing
Then placex has no entry for W1
And W1 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
When updating places
| osm | class | type | housenr | geometry |
| W1 | place | house | 3 | (1,2,3,4,1) |
Then placex contains
| object | parent_place_id |
| W1 | W2 |
And W1 expands to no interpolation
Scenario: housenumbers added to interpolation
Given the grid
| 10 | | | | 11 |
| | 1 | | 2 | |
And the places
| osm | class | type | name | geometry |
| W2 | highway | unclassified | Cloud Street | 10,11 |
And the ways
| id | nodes |
| 1 | 1,2 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W1 | place | houses | even | 1,2 |
When importing
Then W1 expands to no interpolation
When updating places
| osm | class | type | housenr |
| N1 | place | house | 2 |
| N2 | place | house | 6 |
Then W1 expands to interpolation
| parent_place_id | start | end |
| W2 | 4 | 4 |
Scenario: housenumber added in middle of interpolation
Given the grid
| 1 | | | | | 2 |
| 3 | | | 4 | | 5 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | unclassified | Cloud Street | 1, 2 |
And the ways
| id | nodes |
| 2 | 3,4,5 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W2 | place | houses | even | 3,4,5 |
And the places
| osm | class | type | housenr |
| N3 | place | house | 2 |
| N5 | place | house | 10 |
When importing
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 8 |
When updating places
| osm | class | type | housenr |
| N4 | place | house | 6 |
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 4 |
| W1 | 8 | 8 |
@skip
Scenario: housenumber removed in middle of interpolation
Given the grid
| 1 | | | | | 2 |
| 3 | | | 4 | | 5 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | unclassified | Cloud Street | 1, 2 |
And the ways
| id | nodes |
| 2 | 3,4,5 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W2 | place | houses | even | 3,4,5 |
And the places
| osm | class | type | housenr |
| N3 | place | house | 2 |
| N4 | place | house | 6 |
| N5 | place | house | 10 |
When importing
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 4 |
| W1 | 8 | 8 |
When marking for delete N4
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 8 |
Scenario: Change the start housenumber
Given the grid
| 1 | | 2 |
| 3 | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | unclassified | Cloud Street | 1, 2 |
And the ways
| id | nodes |
| 2 | 3,4 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W2 | place | houses | even | 3,4 |
And the places
| osm | class | type | housenr |
| N3 | place | house | 2 |
| N4 | place | house | 6 |
When importing
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 4 |
When updating places
| osm | class | type | housenr |
| N4 | place | house | 8 |
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 6 |
Scenario: Legal interpolation type changed to illegal one
Given the grid
| 1 | | 2 |
| 3 | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | unclassified | Cloud Street | 1, 2 |
And the ways
| id | nodes |
| 2 | 3,4 |
And the places
| osm | class | type | addr+interpolation | geometry |
| W2 | place | houses | even | 3,4 |
And the places
| osm | class | type | housenr |
| N3 | place | house | 2 |
| N4 | place | house | 6 |
When importing
Then W2 expands to interpolation
| parent_place_id | start | end |
| W1 | 4 | 4 |
When updating places
| osm | class | type | addr+interpolation | geometry |
| W2 | place | houses | 12-2 | 3,4 |
Then W2 expands to no interpolation

View File

@@ -0,0 +1,340 @@
Feature: Updates of linked places
Tests that linked places are correctly added and deleted.
Scenario: Linking is kept when boundary is updated
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
When importing
Then placex contains
| object | linked_place_id |
| N1 | R1 |
When updating places
| osm | class | type | name | name+name:de | admin | geometry |
| R1 | boundary | administrative | foo | Dingens | 8 | (10,11,12,13,10) |
Then placex contains
| object | linked_place_id |
| N1 | R1 |
Scenario: Add linked place when linking relation is renamed
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
When importing
Then placex contains
| object | linked_place_id |
| N1 | R1 |
When geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| R1 |
When updating places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foobar | 8 | (10,11,12,13,10) |
Then placex contains
| object | linked_place_id |
| N1 | - |
When geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| N1 |
Scenario: Add linked place when linking relation is removed
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
When importing
And geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| R1 |
When marking for delete R1
Then placex contains
| object | linked_place_id |
| N1 | - |
When geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| N1 |
Scenario: Remove linked place when linking relation is added
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
When importing
And geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| N1 |
When updating places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
Then placex contains
| object | linked_place_id |
| N1 | R1 |
When geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| R1 |
Scenario: Remove linked place when linking relation is renamed
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foobar | 8 | (10,11,12,13,10) |
When importing
And geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| N1 |
When updating places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
Then placex contains
| object | linked_place_id |
| N1 | R1 |
When geocoding "foo"
| dups |
| 1 |
Then all results contain
| object |
| R1 |
Scenario: Update linking relation when linkee name is updated
Given the 0.1 grid
| 10 | | 11 |
| | 3 | |
| 13 | | 12 |
Given the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | rel | 8 | (10,11,12,13,10) |
And the places
| osm | class | type | name+name:de |
| N3 | place | city | greeny |
And the relations
| id | members |
| 1 | N3:label |
When importing
Then placex contains
| object | linked_place_id | name+_place_name:de |
| R1 | - | greeny |
And placex contains
| object | linked_place_id | name+name:de |
| N3 | R1 | greeny |
When updating places
| osm | class | type | name+name:de |
| N3 | place | city | newname |
Then placex contains
| object | linked_place_id | name+name:de |
| N3 | R1 | newname |
And placex contains
| object | linked_place_id | name+_place_name:de |
| R1 | - | newname |
Scenario: Update linking relation when linkee name is deleted
Given the 0.1 grid
| 10 | | 11 |
| | 3 | |
| 13 | | 12 |
Given the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | rel | 8 | (10,11,12,13,10) |
And the places
| osm | class | type | name |
| N3 | place | city | greeny |
And the relations
| id | members |
| 1 | N3:label |
When importing
Then placex contains
| object | linked_place_id | name+_place_name | name+name |
| R1 | - | greeny | rel |
And placex contains
| object | linked_place_id | name+name |
| N3 | R1 | greeny |
When geocoding "greeny"
Then all results contain
| object |
| R1 |
When updating places
| osm | class | type | name+name:de |
| N3 | place | city | depnt |
Then placex contains
| object | linked_place_id | name+name:de |
| N3 | R1 | depnt |
And placex contains
| object | linked_place_id | name+_place_name:de | name+name |
| R1 | - | depnt | rel |
When geocoding "greeny"
Then exactly 0 results are returned
Scenario: Updating linkee extratags keeps linker's extratags
Given the 0.1 grid
| 10 | | 11 |
| | 3 | |
| 13 | | 12 |
Given the named places
| osm | class | type | extra+wikidata | admin | geometry |
| R1 | boundary | administrative | 34 | 8 | (10,11,12,13,10) |
And the named places
| osm | class | type |
| N3 | place | city |
And the relations
| id | members |
| 1 | N3:label |
When importing
Then placex contains
| object | extratags!dict |
| R1 | 'wikidata' : '34', 'linked_place' : 'city' |
When updating places
| osm | class | type | name | extra+oneway |
| N3 | place | city | newname | yes |
Then placex contains
| object | extratags!dict |
| R1 | 'wikidata' : '34', 'oneway' : 'yes', 'linked_place' : 'city' |
Scenario: Remove linked_place info when linkee is removed
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
When importing
Then placex contains
| object | extratags!dict |
| R1 | 'linked_place' : 'city' |
When marking for delete N1
Then placex contains
| object | extratags |
| R1 | - |
Scenario: Update linked_place info when linkee type changes
Given the 0.1 grid
| 10 | | 11 |
| | 1 | |
| 13 | | 12 |
Given the places
| osm | class | type | name |
| N1 | place | city | foo |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (10,11,12,13,10) |
When importing
Then placex contains
| object | extratags!dict |
| R1 | 'linked_place' : 'city' |
When updating places
| osm | class | type | name |
| N1 | place | town | foo |
Then placex contains
| object | extratags!dict |
| R1 | 'linked_place' : 'town' |
Scenario: Keep linking and ranks when place type changes
Given the grid
| 1 | | | 2 |
| | | 9 | |
| 4 | | | 3 |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N1 | place | city | foo | 9 |
When importing
Then placex contains
| object | linked_place_id | rank_address |
| N1 | R1 | 16 |
| R1 | - | 16 |
When updating places
| osm | class | type | name | geometry |
| N1 | place | town | foo | 9 |
Then placex contains
| object | linked_place_id | rank_address |
| N1 | R1 | 16 |
| R1 | - | 16 |
Scenario: Invalidate surrounding place nodes when place type changes
Given the grid
| 1 | | | 2 |
| | 8 | 9 | |
| 4 | | | 3 |
And the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | foo | 8 | (1,2,3,4,1) |
And the places
| osm | class | type | name | geometry |
| N1 | place | town | foo | 9 |
| N2 | place | city | bar | 8 |
And the relations
| id | members |
| 1 | N1:label |
When importing
Then placex contains
| object | linked_place_id | rank_address |
| N1 | R1 | 16 |
| R1 | - | 16 |
| N2 | - | 18 |
When updating places
| osm | class | type | name | geometry |
| N1 | place | suburb | foo | 9 |
Then placex contains
| object | linked_place_id | rank_address |
| N1 | R1 | 20 |
| R1 | - | 20 |
| N2 | - | 16 |

View File

@@ -0,0 +1,20 @@
Feature: Update of names in place objects
Test all naming related issues in updates
Scenario: Delete postcode from postcode boundaries without ref
Given the grid with origin DE
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | postcode | geometry |
| R1 | boundary | postal_code | 123-45 | (1,2,3,4,1) |
When importing
And geocoding "123-45"
Then result 0 contains
| object |
| R1 |
When updating places
| osm | class | type | geometry |
| R1 | boundary | postal_code | (1,2,3,4,1) |
Then placex has no entry for R1

View File

@@ -0,0 +1,163 @@
Feature: Update parenting of objects
Scenario: POI inside building inherits addr:street change
Given the grid
| 10 | | | | | | | 11 |
| | | 5 | | | 6 | | |
| | | | | | | | |
| | | | | 1 | | | |
| 12 | | 8 | | | 7 | | |
And the named places
| osm | class | type |
| N1 | amenity | bank |
And the places
| osm | class | type | street | housenr | geometry |
| W1 | building | yes | nowhere | 3 | (5,6,7,8,5) |
And the places
| osm | class | type | name | geometry |
| W2 | highway | primary | bar | 10,11 |
| W3 | highway | residential | foo | 10,12 |
When importing
Then placex contains
| object | parent_place_id | housenumber |
| W1 | W2 | 3 |
| N1 | W2 | 3 |
When updating places
| osm | class | type | street | addr_place | housenr | geometry |
| W1 | building | yes | foo | nowhere | 3 | (5,6,7,8,5) |
And updating places
| osm | class | type | name |
| N1 | amenity | bank | well |
Then placex contains
| object | parent_place_id | housenumber |
| W1 | W3 | 3 |
| N1 | W3 | 3 |
Scenario: Housenumber is reparented when street gets name matching addr:street
Given the grid
| 1 | | | 2 |
| | 10 | | |
| | | | |
| 3 | | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | A street | 1,2 |
| W2 | highway | residential | B street | 3,4 |
And the places
| osm | class | type | housenr | street | geometry |
| N1 | building | yes | 3 | X street | 10 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
When updating places
| osm | class | type | name | geometry |
| W2 | highway | residential | X street | 3,4 |
Then placex contains
| object | parent_place_id |
| N1 | W2 |
Scenario: Housenumber is reparented when street looses name matching addr:street
Given the grid
| 1 | | | 2 |
| | 10 | | |
| | | | |
| 3 | | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | A street | 1,2 |
| W2 | highway | residential | X street | 3,4 |
And the places
| osm | class | type | housenr | street | geometry |
| N1 | building | yes | 3 | X street | 10 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W2 |
When updating places
| osm | class | type | name | geometry |
| W2 | highway | residential | B street | 3,4 |
Then placex contains
| object | parent_place_id |
| N1 | W1 |
Scenario: Housenumber is reparented when street gets name matching addr:street
Given the grid
| 1 | | | 2 |
| | 10 | | |
| | | | |
| 3 | | | 4 |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | A street | 1,2 |
| W2 | highway | residential | B street | 3,4 |
And the places
| osm | class | type | housenr | street | geometry |
| N1 | building | yes | 3 | X street | 10 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | W1 |
When updating places
| osm | class | type | name | geometry |
| W2 | highway | residential | X street | 3,4 |
Then placex contains
| object | parent_place_id |
| N1 | W2 |
# Invalidation of geometries currently disabled for addr:place matches.
@skip
Scenario: Housenumber is reparented when place is renamed to matching addr:place
Given the grid
| 1 | | | 2 |
| | 10 | 4 | |
| | | | |
| | | 5 | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | A street | 1,2 |
| N5 | place | village | Bdorf | 5 |
| N4 | place | village | Other | 4 |
And the places
| osm | class | type | housenr | addr_place | geometry |
| N1 | building | yes | 3 | Cdorf | 10 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | N4 |
When updating places
| osm | class | type | name | geometry |
| N5 | place | village | Cdorf | 5 |
Then placex contains
| object | parent_place_id |
| N1 | N5 |
Scenario: Housenumber is reparented when it looses a matching addr:place
Given the grid
| 1 | | | 2 |
| | 10 | 4 | |
| | | | |
| | | 5 | |
And the places
| osm | class | type | name | geometry |
| W1 | highway | residential | A street | 1,2 |
| N5 | place | village | Bdorf | 5 |
| N4 | place | village | Other | 4 |
And the places
| osm | class | type | housenr | addr_place | geometry |
| N1 | building | yes | 3 | Bdorf | 10 |
When importing
Then placex contains
| object | parent_place_id |
| N1 | N5 |
When updating places
| osm | class | type | name | geometry |
| N5 | place | village | Cdorf | 5 |
Then placex contains
| object | parent_place_id |
| N1 | N4 |

View File

@@ -0,0 +1,139 @@
Feature: Update of postcode
Tests for updating of data related to postcodes
Scenario: Updating postcode in postcode boundaries without ref
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | postcode | geometry |
| R1 | boundary | postal_code | 12345 | (1,2,3,4,1) |
When importing
And geocoding "12345"
Then result 0 contains
| object |
| R1 |
When updating places
| osm | class | type | postcode | geometry |
| R1 | boundary | postal_code | 54321 | (1,2,3,4,1) |
And geocoding "12345"
Then exactly 0 results are returned
When geocoding "54321"
Then result 0 contains
| object |
| R1 |
Scenario: A new postcode appears in the postcode table
Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N34 | place | house | 01982 | 111 | country:de |
When importing
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 01982 | country:de |
When updating places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N35 | place | house | 4567 | 5 | country:ch |
And updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 01982 | country:de |
| ch | 4567 | country:ch |
Scenario: When the last postcode is deleted, it is deleted from postcode
Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N34 | place | house | 01982 | 111 | country:de |
| N35 | place | house | 4567 | 5 | country:ch |
When importing
And marking for delete N34
And updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| ch | 4567 | country:ch |
Scenario: A postcode is not deleted from postcode when it exist in another country
Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry |
| N34 | place | house | 01982 | 111 | country:de |
| N35 | place | house | 01982 | 5 | country:fr |
When importing
And marking for delete N34
And updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt|
| fr | 01982 | country:fr |
Scenario: Updating a postcode is reflected in postcode table
Given the places
| osm | class | type | addr+postcode | geometry |
| N34 | place | postcode | 01982 | country:de |
When importing
And updating places
| osm | class | type | addr+postcode | geometry |
| N34 | place | postcode | 20453 | country:de |
And updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 20453 | country:de |
Scenario: When changing from a postcode type, the entry appears in placex
When importing
And updating places
| osm | class | type | addr+postcode | geometry |
| N34 | place | postcode | 01982 | country:de |
Then placex has no entry for N34
When updating places
| osm | class | type | addr+postcode | housenr | geometry |
| N34 | place | house | 20453 | 1 | country:de |
Then placex contains
| object | addr+housenumber | geometry!wkt |
| N34 | 1 | country:de |
And place contains exactly
| osm_type | osm_id | class | type |
| N | 34 | place | house |
When updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 20453 | country:de |
Scenario: When changing to a postcode type, the entry disappears from placex
When importing
And updating places
| osm | class | type | addr+postcode | housenr | geometry |
| N34 | place | house | 20453 | 1 | country:de |
Then placex contains
| object | addr+housenumber | geometry!wkt |
| N34 | 1 | country:de|
When updating places
| osm | class | type | addr+postcode | geometry |
| N34 | place | postcode | 01982 | country:de |
Then placex has no entry for N34
And place contains exactly
| osm_type | osm_id | class | type |
| N | 34 | place | postcode |
When updating postcodes
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt |
| de | 01982 | country:de |
Scenario: When a parent is deleted, the postcode gets a new parent
Given the grid with origin DE
| 1 | | 3 | 4 |
| | 9 | | |
| 2 | | 5 | 6 |
Given the places
| osm | class | type | name | admin | geometry |
| R1 | boundary | administrative | Big | 6 | (1,4,6,2,1) |
| R2 | boundary | administrative | Small | 6 | (1,3,5,2,1) |
Given the places
| osm | class | type | addr+postcode | geometry |
| N9 | place | postcode | 12345 | 9 |
When importing
Then location_postcode contains exactly
| postcode | geometry!wkt | parent_place_id |
| 12345 | 9 | R2 |
When marking for delete R2
Then location_postcode contains exactly
| country_code | postcode | geometry!wkt | parent_place_id |
| de | 12345 | 9 | R1 |

View File

@@ -0,0 +1,117 @@
Feature: Update of simple objects
Testing simple updating functionality
Scenario: Do delete small boundary features
Given the 1.0 grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | admin | geometry |
| R1 | boundary | administrative | 3 | (1,2,3,4,1) |
When importing
Then placex contains
| object | rank_search |
| R1 | 6 |
When marking for delete R1
Then placex has no entry for R1
Scenario: Do not delete large boundary features
Given the 2.0 grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | admin | geometry |
| R1 | boundary | administrative | 3 | (1,2,3,4,1) |
When importing
Then placex contains
| object | rank_search |
| R1 | 6 |
When marking for delete R1
Then placex contains
| object | rank_search |
| R1 | 6 |
Scenario: Do delete large features of low rank
Given the 2.0 grid
| 1 | 2 |
| 4 | 3 |
Given the named places
| osm | class | type | geometry |
| W1 | place | house | (1,2,3,4,1) |
| R1 | natural | wood | (1,2,3,4,1) |
| R2 | highway | residential | (1,2,3,4,1) |
When importing
Then placex contains
| object | rank_address |
| R1 | 0 |
| R2 | 26 |
| W1 | 30 |
When marking for delete R1
And marking for delete R2
And marking for delete W1
Then placex has no entry for W1
Then placex has no entry for R1
Then placex has no entry for R2
Scenario: type mutation
Given the places
| osm | class | type | geometry |
| N3 | shop | toys | 1 -1 |
When importing
Then placex contains
| object | class | type | centroid!wkt |
| N3 | shop | toys | 1 -1 |
When updating places
| osm | class | type | geometry |
| N3 | shop | grocery | 1 -1 |
Then placex contains
| object | class | type | centroid!wkt |
| N3 | shop | grocery | 1 -1 |
Scenario: remove postcode place when house number is added
Given the places
| osm | class | type | postcode | geometry |
| N3 | place | postcode | 12345 | country:de |
When importing
Then placex has no entry for N3
When updating places
| osm | class | type | postcode | housenr | geometry |
| N3 | place | house | 12345 | 13 | country:de |
Then placex contains
| object | class | type |
| N3 | place | house |
Scenario: remove boundary when changing from polygon to way
Given the grid
| 1 | 2 |
| 3 | 4 |
And the places
| osm | class | type | name | admin | geometry |
| W1 | boundary | administrative | Haha | 5 | (1, 2, 4, 3, 1) |
When importing
Then placex contains
| object |
| W1 |
When updating places
| osm | class | type | name | admin | geometry |
| W1 | boundary | administrative | Haha | 5 | 1, 2, 4, 3 |
Then placex has no entry for W1
#895
Scenario: update rank when boundary is downgraded from admin to historic
Given the grid
| 1 | 2 |
| 3 | 4 |
And the places
| osm | class | type | name | admin | geometry |
| W1 | boundary | administrative | Haha | 5 | (1, 2, 4, 3, 1) |
When importing
Then placex contains
| object | rank_address |
| W1 | 10 |
When updating places
| osm | class | type | name | admin | geometry |
| W1 | boundary | historic | Haha | 5 | (1, 2, 4, 3, 1) |
Then placex contains
| object | rank_address |
| W1 | 0 |