]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/update/postcode.feature
Remove postcodes also from word table when they no longer exist
[nominatim.git] / test / bdd / db / update / postcode.feature
1 @DB
2 Feature: Update of postcode
3     Tests for updating of data related to postcodes
4
5     Scenario: A new postcode appears in the postcode and word table
6         Given the places
7            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
8            | N34 | place | house | 01982         | 111              |country:de |
9         When importing
10         Then location_postcode contains exactly
11            | country | postcode | geometry |
12            | de      | 01982    | country:de |
13         When updating places
14            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
15            | N35 | place | house | 4567          | 5                |country:ch |
16         And updating postcodes
17         Then location_postcode contains exactly
18            | country | postcode | geometry |
19            | de      | 01982    | country:de |
20            | ch      | 4567     | country:ch |
21         And word contains
22            | word  | class | type |
23            | 01982 | place | postcode |
24            | 4567  | place | postcode |
25
26      Scenario: When the last postcode is deleted, it is deleted from postcode and word
27         Given the places
28            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
29            | N34 | place | house | 01982         | 111              |country:de |
30            | N35 | place | house | 4567          | 5                |country:ch |
31         When importing
32         And marking for delete N34
33         And updating postcodes
34         Then location_postcode contains exactly
35            | country | postcode | geometry |
36            | ch      | 4567     | country:ch |
37         And word contains not
38            | word  | class | type |
39            | 01982 | place | postcode |
40         And word contains
41            | word  | class | type |
42            | 4567  | place | postcode |
43
44      Scenario: A postcode is not deleted from postcode and word when it exist in another country
45         Given the places
46            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
47            | N34 | place | house | 01982         | 111              |country:de |
48            | N35 | place | house | 01982         | 5                |country:ch |
49         When importing
50         And marking for delete N34
51         And updating postcodes
52         Then location_postcode contains exactly
53            | country | postcode | geometry |
54            | ch      | 01982    | country:ch |
55         And word contains
56            | word  | class | type |
57            | 01982 | place | postcode |
58