test_templating_geocoding

This commit is contained in:
Juan Ignacio Sánchez Lara 2018-06-27 08:51:40 +02:00
parent c13d29e4c2
commit 675ef72e30

View File

@ -131,13 +131,31 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp):
")_x', " \
"'''Logroño, La Rioja, Spain''')"
response = self._run_authenticated(query)
# from nose.tools import set_trace; set_trace()
assert_equal(response['total_rows'], 1)
row_by_cartodb_id = self._row_by_cartodb_id(response)
self._assert_x_y(row_by_cartodb_id[1], -2.4449852, 42.4627195)
def test_templating_geocoding(self):
query = "SELECT cartodb_id, st_x(the_geom), st_y(the_geom) from " \
"cdb_dataservices_client.cdb_bulk_geocode_street_point(" \
"'select 1 as cartodb_id, ''Logroño'' as city', " \
"'city || '', '' || ''Spain''') " \
"UNION " \
"SELECT cartodb_id, st_x(the_geom), st_y(the_geom) from " \
"cdb_dataservices_client.cdb_bulk_geocode_street_point(" \
"'select 2 as cartodb_id, ''Logroño'' as city', " \
"'city || '', '' || ''Argentina''')"
response = self._run_authenticated(query)
# from nose.tools import set_trace; set_trace()
assert_equal(response['total_rows'], 2)
row_by_cartodb_id = self._row_by_cartodb_id(response)
self._assert_x_y(row_by_cartodb_id[1], -2.4449852, 42.4627195)
self._assert_x_y(row_by_cartodb_id[2], -61.6961807, -29.5031057)
def _run_authenticated(self, query):
authenticated_query = "{}&api_key={}".format(query,