From 7b988e3f78315bf7dd4a99b927d35ad7eb0ff650 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Fri, 6 Oct 2017 14:37:26 +0200 Subject: [PATCH] Add tests for #382 The examples are not arbitrary: base64 by default ignores characters that are not in its alphabet. When decoding, the dashes and underscores are not b64-valid and therefore ignored, resulting in a sequence with the wrong padding. --- .../cartodb_services/test/test_googlegeocoder.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/lib/python/cartodb_services/test/test_googlegeocoder.py b/server/lib/python/cartodb_services/test/test_googlegeocoder.py index d2ab93c..c910d23 100644 --- a/server/lib/python/cartodb_services/test/test_googlegeocoder.py +++ b/server/lib/python/cartodb_services/test/test_googlegeocoder.py @@ -124,3 +124,13 @@ class GoogleGeocoderTestCase(unittest.TestCase): GoogleMapsGeocoder('another_dummy_client_id', 'lalala', None) + + def test_credentials_with_dashes_can_be_valid(self, req_mock): + GoogleMapsGeocoder('yet_another_dummy_client_id', + 'Ola-k-ase---', + None) + + def test_credentials_with_underscores_can_be_valid(self, req_mock): + GoogleMapsGeocoder('yet_another_dummy_client_id', + 'Ola_k_ase___', + None)