From e82232130690b9169fa1a778cc1fe2fe49fb1c95 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 21 Jun 2016 16:42:18 +0200 Subject: [PATCH] Make test_if_obs_search_is_ok more robust #207 Make the test_if_obs_search_is_ok a bit more robust by narrowing the query to exactly what is expected, as suggested by talos. --- test/integration/test_data_observatory_functions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/integration/test_data_observatory_functions.py b/test/integration/test_data_observatory_functions.py index cb2e78e..cd5778a 100644 --- a/test/integration/test_data_observatory_functions.py +++ b/test/integration/test_data_observatory_functions.py @@ -129,7 +129,9 @@ class TestDataObservatoryFunctions(TestCase): assert_equal(e.message[0], "The api_key must be provided") def test_if_obs_search_is_ok(self): - query = "SELECT id FROM OBS_Search('total_pop') LIMIT 1;&api_key={0}".format(self.env_variables['api_key']) + sql = "SELECT id FROM OBS_Search('total_pop') WHERE id LIKE 'es.ine%' LIMIT 1;" + import urllib + query = "{0}&api_key={1}".format(urllib.quote(sql), self.env_variables['api_key']) result = IntegrationTestHelper.execute_query(self.sql_api_url, query) assert_not_equal(result['id'], None) assert_equal(result['id'], 'es.ine.t1_1')