]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/update/postcode.feature
e25e286711809b3621c0d235de8403b20a7d2ad0
[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         When updating postcodes
88         Then location_postcode contains exactly
89            | country | postcode | geometry |
90            | de      | 20453    | country:de |
91         And word contains
92            | word  | class | type |
93            | 20453 | place | postcode |
94
95      Scenario: When changing to a postcode type, the entry disappears from placex
96         When importing
97         And updating places
98            | osm | class | type  | addr+postcode | housenr |  geometry |
99            | N34 | place | house | 20453         | 1       | country:de |
100         Then placex contains
101            | object | addr+housenumber | geometry |
102            | N34    | 1                | country:de|
103         When updating places
104            | osm | class | type     | addr+postcode |  geometry |
105            | N34 | place | postcode | 01982         | country:de |
106         Then placex has no entry for N34