def test_geocode_place_validation(): """Should validate place for presence of name value """ place = Place() assert not place.validate() place.name = 'place name' assert place.validate()
def test_geocode_place_set_name(): """Should get Place name from field other than coordinates if name is empty """ pl = Place({ 'city': 'Portland', 'country': 'Oregon', 'coordinates': 'my coordinates' }) pl.set_name() assert pl.name == 'Portland' pl.name = '' pl.city = '' pl.country = '' pl.set_name() assert pl.name == ''
def test_geocode_place_set_name(): """Should get Place name from field other than coordinates if name is empty """ pl = Place({'city': 'Portland', 'country': 'Oregon', 'coordinates': 'my coordinates'}) pl.set_name() assert pl.name == 'Portland' pl.name = '' pl.city = '' pl.country = '' pl.set_name() assert pl.name == ''
def test_geocode_place_to_map_json(): """Should convert Place to a dict and drop empty fields """ INPUT = {'name': u'blah', 'coordinates': 'my coordinates'} assert Place(INPUT).to_map_json() == INPUT