mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add functional tests
These are the tests that were formerly located at https://github.com/lonvia/test-nominatim
This commit is contained in:
92
tests/features/db/update/linked_places.feature
Normal file
92
tests/features/db/update/linked_places.feature
Normal file
@@ -0,0 +1,92 @@
|
||||
@DB
|
||||
Feature: Updates of linked places
|
||||
Tests that linked places are correctly added and deleted.
|
||||
|
||||
|
||||
Scenario: Add linked place when linking relation is renamed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foobar | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | None
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
|
||||
Scenario: Add linked place when linking relation is removed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
When marking for delete R1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | None
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
|
||||
Scenario: Remove linked place when linking relation is added
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | R1
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
|
||||
Scenario: Remove linked place when linking relation is renamed
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name | geometry
|
||||
| 1 | place | city | foo | 0 0
|
||||
And the place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foobar | 8 | poly-area:0.1
|
||||
When importing
|
||||
And sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| N
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | name | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | foo | 8 | poly-area:0.1
|
||||
Then table placex contains
|
||||
| object | linked_place_id
|
||||
| N1 | R1
|
||||
When sending query "foo" with dups
|
||||
Then results contain
|
||||
| osm_type
|
||||
| R
|
||||
|
||||
39
tests/features/db/update/naming.feature
Normal file
39
tests/features/db/update/naming.feature
Normal file
@@ -0,0 +1,39 @@
|
||||
@DB
|
||||
Feature: Update of names in place objects
|
||||
Test all naming related issues in updates
|
||||
|
||||
|
||||
Scenario: Updating postcode in postcode boundaries without ref
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
And sending query "12345"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 54321 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
And sending query "12345"
|
||||
Then exactly 0 results are returned
|
||||
When sending query "54321"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
|
||||
|
||||
Scenario: Delete postcode from postcode boundaries without ref
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | postcode | geometry
|
||||
| R | 1 | boundary | postal_code | 12345 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
And sending query "12345"
|
||||
Then results contain
|
||||
| ID | osm_type | osm_id
|
||||
| 0 | R | 1
|
||||
When updating place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| R | 1 | boundary | postal_code | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
Then table placex has no entry for R1
|
||||
|
||||
55
tests/features/db/update/simple.feature
Normal file
55
tests/features/db/update/simple.feature
Normal file
@@ -0,0 +1,55 @@
|
||||
@DB
|
||||
Feature: Update of simple objects
|
||||
Testing simple stuff
|
||||
|
||||
Scenario: Remove name from a landuse object
|
||||
Given the place nodes
|
||||
| osm_id | class | type | name
|
||||
| 1 | landuse | wood | 'name' : 'Foo'
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | class | type | name
|
||||
| N1 | landuse| wood | 'name' : 'Foo'
|
||||
When updating place nodes
|
||||
| osm_id | class | type
|
||||
| 1 | landuse | wood
|
||||
Then table placex has no entry for N1
|
||||
|
||||
|
||||
Scenario: Do delete small boundary features
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | 3 | (0 0, 1 0, 1 1, 0 1, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
When marking for delete R1
|
||||
Then table placex has no entry for R1
|
||||
|
||||
Scenario: Do not delete large boundary features
|
||||
Given the place areas
|
||||
| osm_type | osm_id | class | type | admin_level | geometry
|
||||
| R | 1 | boundary | administrative | 3 | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
When marking for delete R1
|
||||
Then table placex contains
|
||||
| object | rank_search
|
||||
| R1 | 6
|
||||
|
||||
Scenario: Do delete large features of low rank
|
||||
Given the named place areas
|
||||
| osm_type | osm_id | class | type | geometry
|
||||
| W | 1 | place | house | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
| R | 1 | boundary | national_park | (0 0, 2 0, 2 2.1, 0 2, 0 0)
|
||||
When importing
|
||||
Then table placex contains
|
||||
| object | rank_address
|
||||
| R1 | 0
|
||||
| W1 | 30
|
||||
When marking for delete R1,W1
|
||||
Then table placex has no entry for W1
|
||||
Then table placex has no entry for R1
|
||||
Reference in New Issue
Block a user