From 675ef72e30462c769d801837bd471a7186de7582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Wed, 27 Jun 2018 08:51:40 +0200 Subject: [PATCH] test_templating_geocoding --- test/integration/test_street_functions.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/integration/test_street_functions.py b/test/integration/test_street_functions.py index 9214c2f..1ce39b8 100644 --- a/test/integration/test_street_functions.py +++ b/test/integration/test_street_functions.py @@ -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,