From ed828c3b89497a7c09c9d49d67908f9e80c4d70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Wed, 27 Jun 2018 10:13:59 +0200 Subject: [PATCH] test_templating_with_two_columns_geocoding --- test/integration/test_street_functions.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/integration/test_street_functions.py b/test/integration/test_street_functions.py index 1ce39b8..5f8ce60 100644 --- a/test/integration/test_street_functions.py +++ b/test/integration/test_street_functions.py @@ -148,7 +148,6 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): "'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) @@ -156,6 +155,24 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): 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 test_template_with_two_columns_geocoding(self): + query = "SELECT cartodb_id, st_x(the_geom), st_y(the_geom) from " \ + "cdb_dataservices_client.cdb_bulk_geocode_street_point(" \ + " 'select * from (' ||" \ + " ' select 1 as cartodb_id, ''Valladolid'' as city, ''Mexico'' as country ' ||" \ + " ' union all ' ||" \ + " ' select 2, ''Valladolid'', ''Spain''' ||" \ + " ') _x'," \ + "'city || '', '' || country')" + 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], -88.2022488, 20.68964) + self._assert_x_y(row_by_cartodb_id[2], -4.7245321, 41.652251) + def _run_authenticated(self, query): authenticated_query = "{}&api_key={}".format(query,