From 1fdb4d3b3a5fe506c1c698bb37f0f8ac1ab917f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Tue, 13 Feb 2018 18:23:36 +0100 Subject: [PATCH] Pythonic refactor, importing single method --- .../lib/python/cartodb_services/test/test_mapboxgeocoder.py | 4 ++-- server/lib/python/cartodb_services/test/test_mapboxisoline.py | 4 ++-- server/lib/python/cartodb_services/test/test_mapboxmatrix.py | 4 ++-- server/lib/python/cartodb_services/test/test_mapboxrouting.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/lib/python/cartodb_services/test/test_mapboxgeocoder.py b/server/lib/python/cartodb_services/test/test_mapboxgeocoder.py index 84b5213..f895be1 100644 --- a/server/lib/python/cartodb_services/test/test_mapboxgeocoder.py +++ b/server/lib/python/cartodb_services/test/test_mapboxgeocoder.py @@ -2,7 +2,7 @@ import unittest from mock import Mock from cartodb_services.mapbox import MapboxGeocoder from cartodb_services.tools.exceptions import ServiceException -import credentials +from credentials import mapbox_api_key INVALID_TOKEN = 'invalid_token' VALID_ADDRESS = 'Calle Siempreviva 3, Valladolid' @@ -12,7 +12,7 @@ WELL_KNOWN_LATITUDE = 41.668654 class MapboxGeocoderTestCase(unittest.TestCase): def setUp(self): - self.geocoder = MapboxGeocoder(token=credentials.mapbox_api_key(), logger=Mock()) + self.geocoder = MapboxGeocoder(token=mapbox_api_key(), logger=Mock()) def test_invalid_token(self): invalid_geocoder = MapboxGeocoder(token=INVALID_TOKEN, logger=Mock()) diff --git a/server/lib/python/cartodb_services/test/test_mapboxisoline.py b/server/lib/python/cartodb_services/test/test_mapboxisoline.py index be44b3d..ce80d0e 100644 --- a/server/lib/python/cartodb_services/test/test_mapboxisoline.py +++ b/server/lib/python/cartodb_services/test/test_mapboxisoline.py @@ -7,7 +7,7 @@ from cartodb_services.mapbox.routing import MapboxRouting from cartodb_services.tools import Coordinate from cartodb_services.tools.coordinates import (validate_coordinates, marshall_coordinates) -import credentials +from credentials import mapbox_api_key VALID_ORIGIN = Coordinate(-73.989, 40.733) @@ -15,7 +15,7 @@ VALID_ORIGIN = Coordinate(-73.989, 40.733) class MapboxIsolinesTestCase(unittest.TestCase): def setUp(self): - matrix_client = MapboxMatrixClient(token=credentials.mapbox_api_key(), logger=Mock()) + matrix_client = MapboxMatrixClient(token=mapbox_api_key(), logger=Mock()) self.mapbox_isolines = MapboxIsolines(matrix_client, logger=Mock()) def test_calculate_isochrone(self): diff --git a/server/lib/python/cartodb_services/test/test_mapboxmatrix.py b/server/lib/python/cartodb_services/test/test_mapboxmatrix.py index 90cc3f2..579810a 100644 --- a/server/lib/python/cartodb_services/test/test_mapboxmatrix.py +++ b/server/lib/python/cartodb_services/test/test_mapboxmatrix.py @@ -4,7 +4,7 @@ from cartodb_services.mapbox import MapboxMatrixClient from cartodb_services.mapbox.matrix_client import DEFAULT_PROFILE from cartodb_services.tools.exceptions import ServiceException from cartodb_services.tools import Coordinate -import credentials +from credentials import mapbox_api_key INVALID_TOKEN = 'invalid_token' VALID_ORIGIN = Coordinate(-73.989, 40.733) @@ -22,7 +22,7 @@ INVALID_PROFILE = 'invalid_profile' class MapboxMatrixTestCase(unittest.TestCase): def setUp(self): - self.matrix_client = MapboxMatrixClient(token=credentials.mapbox_api_key(), + self.matrix_client = MapboxMatrixClient(token=mapbox_api_key(), logger=Mock()) def test_invalid_profile(self): diff --git a/server/lib/python/cartodb_services/test/test_mapboxrouting.py b/server/lib/python/cartodb_services/test/test_mapboxrouting.py index 8936bd8..2871ab8 100644 --- a/server/lib/python/cartodb_services/test/test_mapboxrouting.py +++ b/server/lib/python/cartodb_services/test/test_mapboxrouting.py @@ -4,7 +4,7 @@ from cartodb_services.mapbox import MapboxRouting from cartodb_services.mapbox.routing import DEFAULT_PROFILE from cartodb_services.tools.exceptions import ServiceException from cartodb_services.tools import Coordinate -import credentials +from credentials import mapbox_api_key INVALID_TOKEN = 'invalid_token' VALID_WAYPOINTS = [Coordinate(-73.989, 40.733), Coordinate(-74, 40.733)] @@ -31,7 +31,7 @@ WELL_KNOWN_LENGTH = 1317.9 class MapboxRoutingTestCase(unittest.TestCase): def setUp(self): - self.routing = MapboxRouting(token=credentials.mapbox_api_key(), logger=Mock()) + self.routing = MapboxRouting(token=mapbox_api_key(), logger=Mock()) def test_invalid_profile(self): with self.assertRaises(ValueError):