def test_closed_crab_location(self):
     closed_adres = {
         "omschrijving_straat": u"Fonteinstraat, 75",
         "huisnummer": u"75",
         "straat": u"Fonteinstraat",
         "postcode": u"3000",
         "gemeente": u"Leuven",
         "land": "BE",
     }
     self.assertDictEqual(closed_adres, nearest_location(testdata.test_geojson_valid))
Example #2
0
 def nearest_address(self):
     data = self._retrieve_json()
     geojson_input = self.validate_geojson(data)
     if check_in_flanders(geojson_input):
         crab_gateway = self.request.crab_gateway() if hasattr(self.request, 'crab_gateway') else None
         address = nearest_location(geojson_input, crab_gateway)
         if address is None:
             return {"found": False}
         return {"found": True, "address": address}
     else:
         raise ValidationFailure(
                 "De geojson geometrie is niet geldig.",
                 {"": "Geometrie ligt niet binnen Vlaanderen"}
         )
 def test_closed_crab_location_False(self):
     self.assertFalse(nearest_location(testdata.test_json_outside_flanders))
 def test_closed_crab_location_none(self):
     self.assertIsNone(nearest_location(testdata.test_json_intersects_flanders))