]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/features/db/update/postcode.feature
release 5.2.0.post7
[nominatim.git] / test / bdd / features / db / update / postcode.feature
1 Feature: Update of postcode
2     Tests for updating of data related to postcodes
3
4      Scenario: Updating postcode in postcode boundaries without ref
5         Given the grid with origin FR
6           | 1 |   | 2 |
7           |   | 9 |   |
8           | 4 |   | 3 |
9         Given the postcodes
10           | osm | postcode | centroid | geometry |
11           | R1  | 12345    | 9        | (1,2,3,4,1) |
12         When importing
13         And geocoding "12345"
14         Then result 0 contains
15          | object |
16          | R1 |
17         Given the postcodes
18           | osm | postcode | centroid | geometry |
19           | R1  | 54321    | 9        | (1,2,3,4,1) |
20         When refreshing postcodes
21         And geocoding "12345"
22         Then exactly 0 results are returned
23         When geocoding "54321"
24         Then result 0 contains
25          | object |
26          | R1 |
27
28     Scenario: A new postcode appears in the postcode table
29         Given the places
30            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
31            | N34 | place | house | 01982         | 111              | country:de |
32         When importing
33         Then location_postcodes contains exactly
34            | country_code | postcode | centroid!wkt |
35            | de           | 01982    | country:de |
36         Given the postcodes
37            | osm | postcode | centroid   |
38            | N66 | 99201    | country:fr |
39         When updating places
40            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
41            | N35 | place | house | 4567          | 5                | country:ch |
42         And refreshing postcodes
43         Then location_postcodes contains exactly
44            | country_code | postcode | centroid!wkt |
45            | de           | 01982    | country:de |
46            | ch           | 4567     | country:ch |
47            | fr           | 99201    | country:fr |
48
49      Scenario: When the last postcode is deleted, it is deleted from postcode
50         Given the places
51            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
52            | N34 | place | house | 01982         | 111              | country:de |
53            | N35 | place | house | 4567          | 5                | country:ch |
54         When importing
55         And marking for delete N34
56         And refreshing postcodes
57         Then location_postcodes contains exactly
58            | country_code | postcode | centroid!wkt |
59            | ch           | 4567     | country:ch |
60
61      Scenario: A postcode is not deleted from postcode when it exist in another country
62         Given the places
63            | osm | class | type  | addr+postcode | addr+housenumber | geometry |
64            | N34 | place | house | 01982         | 111              | country:de |
65            | N35 | place | house | 01982         | 5                | country:fr |
66         When importing
67         And marking for delete N34
68         And refreshing postcodes
69         Then location_postcodes contains exactly
70            | country_code | postcode | centroid!wkt|
71            | fr           | 01982    | country:fr |
72
73      Scenario: Updating a postcode is reflected in postcode table
74         Given the places
75            | osm | class | type     | addr+postcode | geometry |
76            | N34 | place | postcode | 01982         | country:de |
77         When importing
78         And updating places
79            | osm | class | type     | addr+postcode |  geometry |
80            | N34 | place | postcode | 20453         | country:de |
81         And refreshing postcodes
82         Then location_postcodes contains exactly
83            | country_code | postcode | centroid!wkt |
84            | de           | 20453    | country:de |
85
86     Scenario: When a parent is deleted, the postcode gets a new parent
87         Given the grid with origin DE
88            | 1 |   | 3 | 4 |
89            |   | 9 |   |   |
90            | 2 |   | 5 | 6 |
91         Given the places
92            | osm | class    | type           | name  | admin | geometry    |
93            | R1  | boundary | administrative | Big   | 6     | (1,4,6,2,1) |
94            | R2  | boundary | administrative | Small | 6     | (1,3,5,2,1) |
95         Given the postcodes
96            | osm | postcode | centroid |
97            | N9  | 12345    | 9        |
98         When importing
99         Then location_postcodes contains exactly
100            | postcode | centroid!wkt | parent_place_id |
101            | 12345    | 9            | R2              |
102         When marking for delete R2
103         Then location_postcodes contains exactly
104            | country_code | postcode | centroid!wkt | parent_place_id |
105            | de           | 12345    | 9            | R1              |
106
107     Scenario: When a postcode area appears, postcode points are shadowed
108         Given the grid with origin DE
109            | 1 |   | 3 |   |
110            |   | 9 |   | 8 |
111            | 2 |   | 5 |   |
112         Given the postcodes
113            | osm | postcode | centroid |
114            | N92 | 44321    | 9        |
115            | N4  | 00245    | 8        |
116         When importing
117         Then location_postcodes contains exactly
118            | country_code | postcode | osm_id | centroid!wkt |
119            | de           | 44321    | -      | 9            |
120            | de           | 00245    | -      | 8            |
121         Given the postcodes
122            | osm | postcode | centroid | geometry    |
123            | R45 | 00245    | 9        | (1,3,5,2,1) |
124         When refreshing postcodes
125         Then location_postcodes contains exactly
126            | country_code | postcode | osm_id | centroid!wkt |
127            | de           | 00245    | 45     | 9            |
128
129     Scenario: When a postcode area disappears, postcode points are unshadowed
130         Given the grid with origin DE
131            | 1 |   | 3 |   |
132            |   | 9 |   | 8 |
133            | 2 |   | 5 |   |
134         Given the postcodes
135            | osm | postcode | centroid | geometry    |
136            | R45 | 00245    | 9        | (1,3,5,2,1) |
137         Given the postcodes
138            | osm | postcode | centroid |
139            | N92 | 44321    | 9        |
140            | N4  | 00245    | 8        |
141         When importing
142         Then location_postcodes contains exactly
143            | country_code | postcode | osm_id | centroid!wkt |
144            | de           | 00245    | 45     | 9            |
145         When marking for delete R45
146         And refreshing postcodes
147         Then location_postcodes contains exactly
148            | country_code | postcode | osm_id | centroid!wkt |
149            | de           | 44321    | -      | 9            |
150            | de           | 00245    | -      | 8            |