Pythonic refactor, importing single method
This commit is contained in:
parent
029541f298
commit
1fdb4d3b3a
@ -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())
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user