]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/update/postcode.feature
94550ffd6b3f764a0687a8ae628eb154feacdb75
[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
59      Scenario: Updating a postcode is reflected in postcode table
60         Given the places
61            | osm | class | type     | addr+postcode |  geometry |
62            | N34 | place | postcode | 01982         | country:de |
63         When importing
64         And updating places
65            | osm | class | type     | addr+postcode |  geometry |
66            | N34 | place | postcode | 20453         | country:de |
67         And updating postcodes
68         Then location_postcode contains exactly
69            | country | postcode | geometry |
70            | de      | 20453    | country:de |
71         And word contains
72            | word  | class | type |
73            | 20453 | place | postcode |
74
75      Scenario: When changing from a postcode type, the entry appears in placex
76         When importing
77         And updating places
78            | osm | class | type     | addr+postcode |  geometry |
79            | N34 | place | postcode | 01982         | country:de |
80         Then placex has no entry for N34
81         When updating places
82            | osm | class | type  | addr+postcode | housenr |  geometry |
83            | N34 | place | house | 20453         | 1       | country:de |
84         Then placex contains
85            | object | addr+housenumber | geometry |
86            | N34    | 1                | country:de|
87         And place contains exactly
88            | object | class | type  |
89            | N34    | place | house |
90         When updating postcodes
91         Then location_postcode contains exactly
92            | country | postcode | geometry |
93            | de      | 20453    | country:de |
94         And word contains
95            | word  | class | type |
96            | 20453 | place | postcode |
97
98      Scenario: When changing to a postcode type, the entry disappears from placex
99         When importing
100         And updating places
101            | osm | class | type  | addr+postcode | housenr |  geometry |
102            | N34 | place | house | 20453         | 1       | country:de |
103         Then placex contains
104            | object | addr+housenumber | geometry |
105            | N34    | 1                | country:de|
106         When updating places
107            | osm | class | type     | addr+postcode |  geometry |
108            | N34 | place | postcode | 01982         | country:de |
109         Then placex has no entry for N34
110         And place contains exactly
111            | object | class | type     |
112            | N34    | place | postcode |
113         When updating postcodes
114         Then location_postcode contains exactly
115            | country | postcode | geometry |
116            | de      | 01982    | country:de |
117         And word contains
118            | word  | class | type |
119            | 01982 | place | postcode |