Beispiel #1
0
 def test_geocode_on_change(self):
     """
     Tests that address information in a Location is re-geocoded when
     the address is changed.
     """
     self._select_geocoder()
     loc = Location(name="The Piton Foundation",
                    address="370 17th St",
                    address2="#5300",
                    city="Denver",
                    state="CO",
                    postcode="80202")
     loc.save()
     self.assertApxEqual(loc.lat, 39.7438167)
     self.assertApxEqual(loc.lng, -104.9884953)
     loc.name = "The Hull House"
     loc.address = "800 S. Halsted St."
     loc.city = "Chicago"
     loc.state = "IL"
     loc.postcode = "60607"
     loc.save()
     self.assertApxEqual(loc.lat, 41.8716782)
     self.assertApxEqual(loc.lng, -87.6474517)
     self.assertApxEqual(loc.point.x, -87.6474517)
     self.assertApxEqual(loc.point.y, 41.8716782)
Beispiel #2
0
 def test_geocode(self):
     """Test internal geocoding method"""
     self._select_geocoder()
     loc = Location()
     latlng = loc._geocode("370 17th St Denver CO 80202")
     self.assertApxEqual(latlng[0], 39.7438167)
     self.assertApxEqual(latlng[1], -104.9884953)
Beispiel #3
0
 def test_geocode(self):
     """Test internal geocoding method"""
     self._select_geocoder()
     loc = Location()
     latlng = loc._geocode("370 17th St Denver CO 80202")
     self.assertApxEqual(latlng[0], 39.7438167)
     self.assertApxEqual(latlng[1], -104.9884953)
Beispiel #4
0
 def test_geocode_on_save(self):
     """
     Tests that address information in a Location is geocoded when the
     Location is saved
     """
     self._select_geocoder()
     loc = Location(name="The Piton Foundation",
                    address="370 17th St",
                    address2="#5300",
                    city="Denver",
                    state="CO",
                    postcode="80202")
     loc.save()
     self.assertApxEqual(loc.lat, 39.7438167)
     self.assertApxEqual(loc.lng, -104.9884953)
     self.assertApxEqual(loc.point.x, -104.9884953)
     self.assertApxEqual(loc.point.y, 39.7438167)
Beispiel #5
0
 def test_geocode_on_save(self):
     """
     Tests that address information in a Location is geocoded when the
     Location is saved
     """
     self._select_geocoder()
     loc = Location(name="The Piton Foundation",
                    address="370 17th St",
                    address2="#5300",
                    city="Denver",
                    state="CO",
                    postcode="80202")
     loc.save()
     self.assertApxEqual(loc.lat, 39.7438167)
     self.assertApxEqual(loc.lng, -104.9884953)
     self.assertApxEqual(loc.point.x, -104.9884953)
     self.assertApxEqual(loc.point.y, 39.7438167)
Beispiel #6
0
 def test_geocode_on_change(self):
     """
     Tests that address information in a Location is re-geocoded when
     the address is changed.
     """
     self._select_geocoder()
     loc = Location(name="The Piton Foundation",
                    address="370 17th St",
                    address2="#5300",
                    city="Denver",
                    state="CO",
                    postcode="80202")
     loc.save()
     self.assertApxEqual(loc.lat, 39.7438167)
     self.assertApxEqual(loc.lng, -104.9884953)
     loc.name = "The Hull House"
     loc.address = "800 S. Halsted St."
     loc.city = "Chicago"
     loc.state = "IL"
     loc.postcode = "60607"
     loc.save()
     self.assertApxEqual(loc.lat, 41.8716782)
     self.assertApxEqual(loc.lng, -87.6474517)
     self.assertApxEqual(loc.point.x, -87.6474517)
     self.assertApxEqual(loc.point.y, 41.8716782)