Total Complexity | 273 |
Total Lines | 497 |
Duplicated Lines | 19.72 % |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like TestCrabCachedGateway often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | # -*- coding: utf-8 -*- |
||
21 | @pytest.mark.skipif( |
||
22 | not pytest.config.getoption('--crab-integration'), |
||
23 | reason='No CRAB Integration tests required' |
||
24 | ) |
||
25 | class TestCrabCachedGateway: |
||
26 | |||
27 | def setup_method(self, method): |
||
28 | self.crab_client = crab_factory() |
||
29 | self.crab = CrabGateway( |
||
30 | self.crab_client, |
||
31 | cache_config={ |
||
32 | 'permanent.backend': 'dogpile.cache.memory', |
||
33 | 'permanent.expiration_time': 86400, |
||
34 | 'long.backend': 'dogpile.cache.memory', |
||
35 | 'long.expiration_time': 3600, |
||
36 | 'short.backend': 'dogpile.cache.memory', |
||
37 | 'short.expiration_time': 600, |
||
38 | } |
||
39 | ) |
||
40 | |||
41 | def teardown_method(self, method): |
||
42 | self.crab_client = None |
||
43 | self.crab = None |
||
44 | |||
45 | def test_cache_is_configured(self): |
||
46 | from dogpile.cache.backends.memory import MemoryBackend |
||
47 | assert isinstance( |
||
48 | self.crab.caches['permanent'].backend, |
||
49 | MemoryBackend |
||
50 | ) |
||
51 | assert self.crab.caches['permanent'].is_configured |
||
52 | |||
53 | def test_list_gewesten(self): |
||
54 | res = self.crab.list_gewesten() |
||
55 | assert isinstance(res, list) |
||
56 | assert self.crab.caches['permanent'].get('ListGewesten#1') == res |
||
57 | |||
58 | def test_list_gewesten_different_sort(self): |
||
59 | res = self.crab.list_gewesten(2) |
||
60 | assert isinstance(res, list) |
||
61 | assert self.crab.caches['permanent'].get('ListGewesten#2') == res |
||
62 | from dogpile.cache.api import NO_VALUE |
||
63 | assert self.crab.caches['permanent'].get('ListGewesten#1') == NO_VALUE |
||
64 | |||
65 | def test_list_provincies(self): |
||
66 | res = self.crab.list_provincies(2) |
||
67 | assert isinstance(res, list) |
||
68 | assert self.crab.caches['permanent'].get('ListProvinciesByGewestId#2') == res |
||
69 | assert (res[0].gewest.id, 2) |
||
70 | |||
71 | def test_get_provincie_by_id(self): |
||
72 | res = self.crab.get_provincie_by_id(10000) |
||
73 | assert isinstance(res, Provincie) |
||
74 | assert self.crab.caches['permanent'].get('GetProvincieByProvincieNiscode#10000') == res |
||
75 | |||
76 | def test_list_gemeenten_default_is_Vlaanderen(self): |
||
77 | res = self.crab.list_gemeenten() |
||
78 | assert isinstance(res, list) |
||
79 | assert self.crab.caches['permanent'].get('ListGemeentenByGewestId#2#1') == res |
||
80 | assert (res[0].gewest.id, 2) |
||
81 | |||
82 | def test_list_gemeenten_gewest_1(self): |
||
83 | gewest = Gewest(1) |
||
84 | r = self.crab.list_gemeenten(gewest) |
||
85 | assert isinstance(r, list) |
||
86 | assert self.crab.caches['permanent'].get('ListGemeentenByGewestId#1#1') == r |
||
87 | assert (r[0].gewest.id, 1) |
||
88 | |||
89 | def test_list_gemeenten_different_sort(self): |
||
90 | res = self.crab.list_gemeenten(2, 1) |
||
91 | assert isinstance(res, list) |
||
92 | assert self.crab.caches['permanent'].get('ListGemeentenByGewestId#2#1') == res |
||
93 | gewest = Gewest(2) |
||
94 | r = self.crab.list_gemeenten(gewest, 2) |
||
95 | assert isinstance(r, list) |
||
96 | assert self.crab.caches['permanent'].get('ListGemeentenByGewestId#2#2') == r |
||
97 | assert not res == r |
||
98 | |||
99 | def test_list_gemeenten_by_provincie(self): |
||
100 | res = self.crab.list_gemeenten_by_provincie(10000) |
||
101 | provincie = self.crab.get_provincie_by_id(10000) |
||
102 | assert isinstance(res, list) |
||
103 | assert self.crab.caches['long'].get('ListGemeentenByProvincieId#10000') == res |
||
104 | provincie = self.crab.get_provincie_by_id(10000) |
||
105 | res = self.crab.list_gemeenten_by_provincie(provincie) |
||
106 | assert isinstance(res, list) |
||
107 | assert self.crab.caches['long'].get('ListGemeentenByProvincieId#10000') == res |
||
108 | |||
109 | def test_get_gemeente_by_id(self): |
||
110 | res = self.crab.get_gemeente_by_id(1) |
||
111 | assert isinstance(res, Gemeente) |
||
112 | assert self.crab.caches['long'].get('GetGemeenteByGemeenteId#1') == res |
||
113 | |||
114 | def test_get_gemeente_by_niscode(self): |
||
115 | res = self.crab.get_gemeente_by_niscode(11001) |
||
116 | assert isinstance(res, Gemeente) |
||
117 | assert self.crab.caches['long'].get('GetGemeenteByNISGemeenteCode#11001') == res |
||
118 | |||
119 | def test_list_deelgemeenten_by_gemeente(self): |
||
120 | res = self.crab.list_deelgemeenten_by_gemeente(45062) |
||
121 | assert isinstance(res, list) |
||
122 | assert self.crab.caches['permanent'].get('ListDeelgemeentenByGemeenteId#45062') == res |
||
123 | gemeente = self.crab.get_gemeente_by_niscode(45062) |
||
124 | res = self.crab.list_deelgemeenten_by_gemeente(gemeente) |
||
125 | assert isinstance(res, list) |
||
126 | assert self.crab.caches['permanent'].get('ListDeelgemeentenByGemeenteId#45062') == res |
||
127 | |||
128 | def test_get_deelgemeente_by_id(self): |
||
129 | res = self.crab.get_deelgemeente_by_id('45062A') |
||
130 | assert isinstance(res, Deelgemeente) |
||
131 | assert self.crab.caches['permanent'].get('GetDeelgemeenteByDeelgemeenteId#45062A') == res |
||
132 | |||
133 | def test_list_talen(self): |
||
134 | res = self.crab.list_talen() |
||
135 | assert isinstance(res, list) |
||
136 | assert self.crab.caches['permanent'].get('ListTalen#1') == res |
||
137 | |||
138 | def test_list_talen_different_sort(self): |
||
139 | res = self.crab.list_talen(2) |
||
140 | assert isinstance(res, list) |
||
141 | assert self.crab.caches['permanent'].get('ListTalen#2') == res |
||
142 | from dogpile.cache.api import NO_VALUE |
||
143 | assert self.crab.caches['permanent'].get('ListTalen#1') == NO_VALUE |
||
144 | |||
145 | def test_list_bewerkingen(self): |
||
146 | res = self.crab.list_bewerkingen() |
||
147 | assert isinstance(res, list) |
||
148 | assert self.crab.caches['permanent'].get('ListBewerkingen#1') == res |
||
149 | |||
150 | def test_list_bewerkingen_different_sort(self): |
||
151 | res = self.crab.list_bewerkingen(2) |
||
152 | assert isinstance(res, list) |
||
153 | assert self.crab.caches['permanent'].get('ListBewerkingen#2') == res |
||
154 | from dogpile.cache.api import NO_VALUE |
||
155 | assert self.crab.caches['permanent'].get('ListBewerkingen#1') == NO_VALUE |
||
156 | |||
157 | def test_list_organisaties(self): |
||
158 | res = self.crab.list_organisaties() |
||
159 | assert isinstance(res, list) |
||
160 | assert self.crab.caches['permanent'].get('ListOrganisaties#1') == res |
||
161 | |||
162 | def test_list_organisaties_different_sort(self): |
||
163 | res = self.crab.list_organisaties(2) |
||
164 | assert isinstance(res, list) |
||
165 | assert self.crab.caches['permanent'].get('ListOrganisaties#2') == res |
||
166 | from dogpile.cache.api import NO_VALUE |
||
167 | assert self.crab.caches['permanent'].get('ListOrganisaties#1') == NO_VALUE |
||
168 | |||
169 | def test_list_aardadressen(self): |
||
170 | res = self.crab.list_aardadressen() |
||
171 | assert isinstance(res, list) |
||
172 | assert self.crab.caches['permanent'].get('ListAardAdressen#1') == res |
||
173 | |||
174 | def test_list_aardadressen_different_sort(self): |
||
175 | res = self.crab.list_aardadressen(2) |
||
176 | assert isinstance(res, list) |
||
177 | assert self.crab.caches['permanent'].get('ListAardAdressen#2') == res |
||
178 | from dogpile.cache.api import NO_VALUE |
||
179 | assert self.crab.caches['permanent'].get('ListAardAdressen#1') == NO_VALUE |
||
180 | |||
181 | def test_list_aardgebouwen(self): |
||
182 | res = self.crab.list_aardgebouwen() |
||
183 | assert isinstance(res, list) |
||
184 | assert self.crab.caches['permanent'].get('ListAardGebouwen#1') == res |
||
185 | |||
186 | def test_list_aardgebouwen_different_sort(self): |
||
187 | res = self.crab.list_aardgebouwen(2) |
||
188 | assert isinstance(res, list) |
||
189 | assert self.crab.caches['permanent'].get('ListAardGebouwen#2') == res |
||
190 | from dogpile.cache.api import NO_VALUE |
||
191 | assert self.crab.caches['permanent'].get('ListAardGebouwen#1') == NO_VALUE |
||
192 | |||
193 | def test_list_aardwegobjecten(self): |
||
194 | res = self.crab.list_aardwegobjecten() |
||
195 | assert isinstance(res, list) |
||
196 | assert self.crab.caches['permanent'].get('ListAardWegobjecten#1') == res |
||
197 | |||
198 | def test_list_aardwegobjecten_different_sort(self): |
||
199 | res = self.crab.list_aardwegobjecten(2) |
||
200 | assert isinstance(res, list) |
||
201 | assert self.crab.caches['permanent'].get('ListAardWegobjecten#2') == res |
||
202 | from dogpile.cache.api import NO_VALUE |
||
203 | assert self.crab.caches['permanent'].get('ListAardWegobjecten#1') == NO_VALUE |
||
204 | |||
205 | def test_list_aardterreinobjecten(self): |
||
206 | res = self.crab.list_aardterreinobjecten() |
||
207 | assert isinstance(res, list) |
||
208 | assert self.crab.caches['permanent'].get('ListAardTerreinobjecten#1') == res |
||
209 | |||
210 | def test_list_aardterreinobjecten_different_sort(self): |
||
211 | res = self.crab.list_aardterreinobjecten(2) |
||
212 | assert isinstance(res, list) |
||
213 | assert self.crab.caches['permanent'].get('ListAardTerreinobjecten#2') == res |
||
214 | from dogpile.cache.api import NO_VALUE |
||
215 | assert self.crab.caches['permanent'].get('ListAardTerreinobjecten#1') == NO_VALUE |
||
216 | |||
217 | def test_list_statushuisnummers(self): |
||
218 | res = self.crab.list_statushuisnummers() |
||
219 | assert isinstance(res, list) |
||
220 | assert self.crab.caches['permanent'].get('ListStatusHuisnummers#1') == res |
||
221 | |||
222 | def test_list_statushuisnummers_different_sort(self): |
||
223 | res = self.crab.list_statushuisnummers(2) |
||
224 | assert isinstance(res, list) |
||
225 | assert self.crab.caches['permanent'].get('ListStatusHuisnummers#2') == res |
||
226 | from dogpile.cache.api import NO_VALUE |
||
227 | assert self.crab.caches['permanent'].get('ListStatusHuisnummers#1') == NO_VALUE |
||
228 | |||
229 | def test_list_statussubadressen(self): |
||
230 | res = self.crab.list_statussubadressen() |
||
231 | assert isinstance(res, list) |
||
232 | assert self.crab.caches['permanent'].get('ListStatusSubadressen#1') == res |
||
233 | |||
234 | def test_list_statussubadressen_different_sort(self): |
||
235 | res = self.crab.list_statussubadressen(2) |
||
236 | assert isinstance(res, list) |
||
237 | assert self.crab.caches['permanent'].get('ListStatusSubadressen#2') == res |
||
238 | from dogpile.cache.api import NO_VALUE |
||
239 | assert self.crab.caches['permanent'].get('ListStatusSubadressen#1') == NO_VALUE |
||
240 | |||
241 | def test_list_statusstraatnamen(self): |
||
242 | res = self.crab.list_statusstraatnamen() |
||
243 | assert isinstance(res, list) |
||
244 | assert self.crab.caches['permanent'].get('ListStatusStraatnamen#1') == res |
||
245 | |||
246 | def test_list_statusstraatnamen_different_sort(self): |
||
247 | res = self.crab.list_statusstraatnamen(2) |
||
248 | assert isinstance(res, list) |
||
249 | assert self.crab.caches['permanent'].get('ListStatusStraatnamen#2') == res |
||
250 | from dogpile.cache.api import NO_VALUE |
||
251 | assert self.crab.caches['permanent'].get('ListStatusStraatnamen#1') == NO_VALUE |
||
252 | |||
253 | def test_list_statuswegsegmenten(self): |
||
254 | res = self.crab.list_statuswegsegmenten() |
||
255 | assert isinstance(res, list) |
||
256 | assert self.crab.caches['permanent'].get('ListStatusWegsegmenten#1') == res |
||
257 | |||
258 | def test_list_statuswegsegmenten_different_sort(self): |
||
259 | res = self.crab.list_statuswegsegmenten(2) |
||
260 | assert isinstance(res, list) |
||
261 | assert self.crab.caches['permanent'].get('ListStatusWegsegmenten#2') == res |
||
262 | |||
263 | from dogpile.cache.api import NO_VALUE |
||
264 | assert self.crab.caches['permanent'].get('ListStatusWegsegmenten#1') == NO_VALUE |
||
265 | |||
266 | def test_list_geometriemethodewegsegmenten(self): |
||
267 | res = self.crab.list_geometriemethodewegsegmenten() |
||
268 | assert isinstance(res, list) |
||
269 | assert self.crab.caches['permanent'].get('ListGeometriemethodeWegsegmenten#1') == res |
||
270 | |||
271 | def test_list_geometriemethodewegsegmenten_different_sort(self): |
||
272 | res = self.crab.list_geometriemethodewegsegmenten(2) |
||
273 | assert isinstance(res, list) |
||
274 | assert self.crab.caches['permanent'].get('ListGeometriemethodeWegsegmenten#2') == res |
||
275 | from dogpile.cache.api import NO_VALUE |
||
276 | assert self.crab.caches['permanent'].get('ListGeometriemethodeWegsegmenten#1') == NO_VALUE |
||
277 | |||
278 | def test_list_statusgebouwen(self): |
||
279 | res = self.crab.list_statusgebouwen() |
||
280 | assert isinstance(res, list) |
||
281 | assert self.crab.caches['permanent'].get('ListStatusGebouwen#1') == res |
||
282 | |||
283 | def test_list_statusgebouwen_different_sort(self): |
||
284 | res = self.crab.list_statusgebouwen(2) |
||
285 | assert isinstance(res, list) |
||
286 | assert self.crab.caches['permanent'].get('ListStatusGebouwen#2') == res |
||
287 | from dogpile.cache.api import NO_VALUE |
||
288 | assert self.crab.caches['permanent'].get('ListStatusGebouwen#1') == NO_VALUE |
||
289 | |||
290 | def test_list_geometriemethodegebouwen(self): |
||
291 | res = self.crab.list_geometriemethodegebouwen() |
||
292 | assert isinstance(res, list) |
||
293 | assert self.crab.caches['permanent'].get('ListGeometriemethodeGebouwen#1') == res |
||
294 | |||
295 | def test_list_geometriemethodegebouwen_different_sort(self): |
||
296 | res = self.crab.list_geometriemethodegebouwen(2) |
||
297 | assert isinstance(res, list) |
||
298 | assert self.crab.caches['permanent'].get('ListGeometriemethodeGebouwen#2') == res |
||
299 | from dogpile.cache.api import NO_VALUE |
||
300 | assert self.crab.caches['permanent'].get('ListGeometriemethodeGebouwen#1') == NO_VALUE |
||
301 | |||
302 | def test_list_herkomstadrespositie(self): |
||
303 | res = self.crab.list_herkomstadresposities() |
||
304 | assert isinstance(res, list) |
||
305 | assert self.crab.caches['permanent'].get('ListHerkomstAdresposities#1') == res |
||
306 | |||
307 | def test_list_herkomstadrespositie_different_sort(self): |
||
308 | res = self.crab.list_herkomstadresposities(2) |
||
309 | assert isinstance(res, list) |
||
310 | assert self.crab.caches['permanent'].get('ListHerkomstAdresposities#2') == res |
||
311 | from dogpile.cache.api import NO_VALUE |
||
312 | assert self.crab.caches['permanent'].get('ListHerkomstAdresposities#1') == NO_VALUE |
||
313 | |||
314 | def test_list_straten(self): |
||
315 | res = self.crab.list_straten(1) |
||
316 | assert isinstance(res, list) |
||
317 | assert self.crab.caches['long'].get('ListStraatnamenWithStatusByGemeenteId#11') == res |
||
318 | gem = self.crab.get_gemeente_by_id(2) |
||
319 | r = self.crab.list_straten(gem) |
||
320 | assert isinstance(r, list) |
||
321 | assert self.crab.caches['long'].get('ListStraatnamenWithStatusByGemeenteId#21') == r |
||
322 | |||
323 | def test_list_straten_different_sort(self): |
||
324 | res = self.crab.list_straten(1, 2) |
||
325 | assert isinstance(res, list) |
||
326 | assert self.crab.caches['long'].get('ListStraatnamenWithStatusByGemeenteId#12') == res |
||
327 | gem = self.crab.get_gemeente_by_id(2) |
||
328 | r = self.crab.list_straten(gem, 2) |
||
329 | assert isinstance(r, list) |
||
330 | assert self.crab.caches['long'].get('ListStraatnamenWithStatusByGemeenteId#22') == r |
||
331 | from dogpile.cache.api import NO_VALUE |
||
332 | assert self.crab.caches['long'].get('ListStraatnamenWithStatusByGemeenteId#11') == NO_VALUE |
||
333 | |||
334 | def test_get_straat_by_id(self): |
||
335 | res = self.crab.get_straat_by_id(1) |
||
336 | assert isinstance(res, Straat) |
||
337 | assert self.crab.caches['long'].get('GetStraatnaamWithStatusByStraatnaamId#1') == res |
||
338 | |||
339 | def test_list_huisnummers_by_straat(self): |
||
340 | res = self.crab.list_huisnummers_by_straat(1) |
||
341 | assert isinstance(res, list) |
||
342 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByStraatnaamId#11') == res |
||
343 | straat = self.crab.get_straat_by_id(2) |
||
344 | r = self.crab.list_huisnummers_by_straat(straat) |
||
345 | assert isinstance(r, list) |
||
346 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByStraatnaamId#21') == r |
||
347 | |||
348 | def test_list_huisnummers_by_perceel(self): |
||
349 | res = self.crab.list_huisnummers_by_perceel('13040C1747/00G002') |
||
350 | assert isinstance(res, list) |
||
351 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByIdentificatorPerceel#13040C1747/00G0021') == res |
||
352 | perceel = self.crab.get_perceel_by_id('13040C1747/00H002') |
||
353 | r = self.crab.list_huisnummers_by_perceel(perceel) |
||
354 | assert isinstance(r, list) |
||
355 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByIdentificatorPerceel#13040C1747/00H0021') == r |
||
356 | |||
357 | def test_list_huisnummers_by_straat_different_sort(self): |
||
358 | res = self.crab.list_huisnummers_by_straat(1, 2) |
||
359 | assert isinstance(res, list) |
||
360 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByStraatnaamId#12') == res |
||
361 | straat = self.crab.get_straat_by_id(2) |
||
362 | r = self.crab.list_huisnummers_by_straat(straat, 2) |
||
363 | assert isinstance(r, list) |
||
364 | assert self.crab.caches['short'].get('ListHuisnummersWithStatusByStraatnaamId#22') == r |
||
365 | |||
366 | def test_get_huisnummer_by_id(self): |
||
367 | res = self.crab.get_huisnummer_by_id(1) |
||
368 | assert isinstance(res, Huisnummer) |
||
369 | assert self.crab.caches['short'].get('GetHuisnummerWithStatusByHuisnummerId#1') == res |
||
370 | |||
371 | def test_get_huisnummer_by_nummer_and_straat(self): |
||
372 | res = self.crab.get_huisnummer_by_nummer_and_straat(1, 1) |
||
373 | assert isinstance(res, Huisnummer) |
||
374 | assert self.crab.caches['short'].get('GetHuisnummerWithStatusByHuisnummer#11') == res |
||
375 | straat = self.crab.get_straat_by_id(1) |
||
376 | res = self.crab.get_huisnummer_by_nummer_and_straat(1, straat) |
||
377 | assert isinstance(res, Huisnummer) |
||
378 | assert self.crab.caches['short'].get("GetHuisnummerWithStatusByHuisnummer#11") == res |
||
379 | |||
380 | def test_list_postkantons_by_gemeente(self): |
||
381 | res = self.crab.list_postkantons_by_gemeente(1) |
||
382 | assert isinstance(res, list) |
||
383 | assert self.crab.caches['long'].get('ListPostkantonsByGemeenteId#1') == res |
||
384 | gemeente = self.crab.get_gemeente_by_id(2) |
||
385 | r = self.crab.list_postkantons_by_gemeente(gemeente) |
||
386 | assert isinstance(r, list) |
||
387 | assert self.crab.caches['long'].get('ListPostkantonsByGemeenteId#2') == r |
||
388 | |||
389 | def test_get_postkanton_by_huisnummer(self): |
||
390 | res = self.crab.get_postkanton_by_huisnummer(1) |
||
391 | assert isinstance(res, Postkanton) |
||
392 | assert self.crab.caches['short'].get('GetPostkantonByHuisnummerId#1') == res |
||
393 | huisnummer = self.crab.get_huisnummer_by_id(1) |
||
394 | r = self.crab.get_postkanton_by_huisnummer(huisnummer) |
||
395 | assert isinstance(r, Postkanton) |
||
396 | assert self.crab.caches['short'].get('GetPostkantonByHuisnummerId#1') == r |
||
397 | |||
398 | def test_list_wegobjecten_by_straat(self): |
||
399 | res = self.crab.list_wegobjecten_by_straat(1) |
||
400 | assert isinstance(res, list) |
||
401 | assert self.crab.caches['short'].get('ListWegobjectenByStraatnaamId#1') == res |
||
402 | straat = self.crab.get_straat_by_id(2) |
||
403 | res = self.crab.list_wegobjecten_by_straat(straat) |
||
404 | assert self.crab.caches['short'].get('ListWegobjectenByStraatnaamId#2') == res |
||
405 | |||
406 | def test_get_wegobject_by_id(self): |
||
407 | res = self.crab.get_wegobject_by_id("53839893") |
||
408 | assert isinstance(res, Wegobject) |
||
409 | assert self.crab.caches['short'].get('GetWegobjectByIdentificatorWegobject#53839893') == res |
||
410 | |||
411 | def test_list_wegsegmenten_by_straat(self): |
||
412 | res = self.crab.list_wegsegmenten_by_straat(1) |
||
413 | assert isinstance(res, list) |
||
414 | assert self.crab.caches['short'].get('ListWegsegmentenByStraatnaamId#1') == res |
||
415 | straat = self.crab.get_straat_by_id(2) |
||
416 | r = self.crab.list_wegsegmenten_by_straat(straat) |
||
417 | assert self.crab.caches['short'].get('ListWegsegmentenByStraatnaamId#2') == r |
||
418 | |||
419 | def test_get_wegsegment_by_id(self): |
||
420 | res = self.crab.get_wegsegment_by_id("108724") |
||
421 | assert isinstance(res, Wegsegment) |
||
422 | assert self.crab.caches['short'].get('GetWegsegmentByIdentificatorWegsegment#108724') == res |
||
423 | |||
424 | def test_list_terreinobjecten_by_huisnummer(self): |
||
425 | res = self.crab.list_terreinobjecten_by_huisnummer(1) |
||
426 | assert isinstance(res, list) |
||
427 | assert self.crab.caches['short'].get('ListTerreinobjectenByHuisnummerId#1') == res |
||
428 | huisnummer = self.crab.get_huisnummer_by_id(1) |
||
429 | res = self.crab.list_terreinobjecten_by_huisnummer(huisnummer) |
||
430 | assert isinstance(res, list) |
||
431 | assert self.crab.caches['short'].get('ListTerreinobjectenByHuisnummerId#1') == res |
||
432 | |||
433 | def test_get_terreinobject_by_id(self): |
||
434 | res = self.crab.get_terreinobject_by_id("13040_C_1747_G_002_00") |
||
435 | assert isinstance(res, Terreinobject) |
||
436 | assert self.crab.caches['short'].get('GetTerreinobjectByIdentificatorTerreinobject#13040_C_1747_G_002_00') == res |
||
437 | |||
438 | def test_list_percelen_by_huisnummer(self): |
||
439 | res = self.crab.list_percelen_by_huisnummer(1) |
||
440 | assert isinstance(res, list) |
||
441 | assert self.crab.caches['short'].get('ListPercelenByHuisnummerId#1') == res |
||
442 | huisnummer = self.crab.get_huisnummer_by_id(1) |
||
443 | res = self.crab.list_percelen_by_huisnummer(huisnummer) |
||
444 | assert isinstance(res, list) |
||
445 | assert self.crab.caches['short'].get('ListPercelenByHuisnummerId#1') == res |
||
446 | |||
447 | def test_get_perceel_by_id(self): |
||
448 | res = self.crab.get_perceel_by_id("13040C1747/00G002") |
||
449 | assert isinstance(res, Perceel) |
||
450 | assert self.crab.caches['short'].get('GetPerceelByIdentificatorPerceel#13040C1747/00G002') == res |
||
451 | |||
452 | def test_list_gebouwen_by_huisnummer(self): |
||
453 | res = self.crab.list_gebouwen_by_huisnummer(1) |
||
454 | assert isinstance(res, list) |
||
455 | assert self.crab.caches['short'].get('ListGebouwenByHuisnummerId#1') == res |
||
456 | huisnummer = self.crab.get_huisnummer_by_id(1) |
||
457 | res = self.crab.list_gebouwen_by_huisnummer(huisnummer) |
||
458 | assert isinstance(res, list) |
||
459 | assert self.crab.caches['short'].get('ListGebouwenByHuisnummerId#1') == res |
||
460 | |||
461 | def test_get_gebouw_by_id(self): |
||
462 | res = self.crab.get_gebouw_by_id("1538575") |
||
463 | assert isinstance(res, Gebouw) |
||
464 | assert self.crab.caches['short'].get('GetGebouwByIdentificatorGebouw#1538575') == res |
||
465 | |||
466 | def test_list_subadressen_by_huisnummer(self): |
||
467 | res = self.crab.list_subadressen_by_huisnummer(129462) |
||
468 | assert isinstance(res, list) |
||
469 | assert self.crab.caches['short'].get('ListSubadressenWithStatusByHuisnummerId#129462') == res |
||
470 | huisnummer = self.crab.get_huisnummer_by_id(129462) |
||
471 | res = self.crab.list_subadressen_by_huisnummer(huisnummer) |
||
472 | assert isinstance(res, list) |
||
473 | assert self.crab.caches['short'].get('ListSubadressenWithStatusByHuisnummerId#129462') == res |
||
474 | |||
475 | def test_get_subadres_by_id(self): |
||
476 | res = self.crab.get_subadres_by_id(1120934) |
||
477 | assert isinstance(res, Subadres) |
||
478 | assert self.crab.caches['short'].get('GetSubadresWithStatusBySubadresId#1120934') == res |
||
479 | |||
480 | def test_list_adresposities_by_huisnummer(self): |
||
481 | res = self.crab.list_adresposities_by_huisnummer(1) |
||
482 | assert isinstance(res, list) |
||
483 | assert self.crab.caches['short'].get('ListAdrespositiesByHuisnummerId#1') == res |
||
484 | |||
485 | def test_list_adresposities_by_nummer_and_straat(self): |
||
486 | res = self.crab.list_adresposities_by_nummer_and_straat(1, 1) |
||
487 | assert isinstance(res, list) |
||
488 | assert self.crab.caches['short'].get('ListAdrespositiesByHuisnummer#11') == res |
||
489 | |||
490 | def test_list_adresposities_by_subadres(self): |
||
491 | res = self.crab.list_adresposities_by_subadres(1120936) |
||
492 | assert isinstance(res, list) |
||
493 | assert self.crab.caches['short'].get('ListAdrespositiesBySubadresId#1120936') == res |
||
494 | |||
495 | def test_list_adresposities_by_subadres_and_huisnummer(self): |
||
496 | res = self.crab.list_adresposities_by_subadres_and_huisnummer('A', 129462) |
||
497 | assert isinstance(res, list) |
||
498 | assert self.crab.caches['short'].get('ListAdrespositiesBySubadres#A129462') == res |
||
499 | huisnummer = self.crab.get_huisnummer_by_id(129462) |
||
500 | res = self.crab.list_adresposities_by_subadres_and_huisnummer('A', huisnummer) |
||
501 | assert isinstance(res, list) |
||
502 | assert self.crab.caches['short'].get('ListAdrespositiesBySubadres#A129462') == res |
||
503 | |||
504 | def test_get_adrespositie_by_id(self): |
||
505 | res = self.crab.get_adrespositie_by_id(4428005) |
||
506 | assert isinstance(res, Adrespositie) |
||
507 | assert str(self.crab.caches['short'].get('GetAdrespositieByAdrespositieId#4428005')) == str(res) |
||
508 | |||
509 | def test_get_postadres_by_huisnummer(self): |
||
510 | res = self.crab.get_postadres_by_huisnummer(1) |
||
511 | assert res == 'Steenweg op Oosthoven 51, 2300 Turnhout' |
||
512 | assert str(self.crab.caches['short'].get('GetPostadresByHuisnummerId#1')) == str(res) |
||
513 | |||
514 | def test_get_postadres_by_subadres(self): |
||
515 | res = self.crab.get_postadres_by_subadres(1120936) |
||
516 | assert res == 'Antoon van Brabantstraat 7 bus B, 2630 Aartselaar' |
||
517 | assert str(self.crab.caches['short'].get('GetPostadresBySubadresId#1120936')) == str(res) |
||
518 |