diff --git a/noxfile.py b/noxfile.py index 826477c01..7e8b5a008 100644 --- a/noxfile.py +++ b/noxfile.py @@ -130,7 +130,7 @@ def system(session): session.install('mock', 'pytest') systest_deps = [ 'google-cloud-bigquery', - 'google-cloud-pubsub', + 'google-cloud-pubsub < 2.0.0', 'google-cloud-storage', 'google-cloud-testutils', ] diff --git a/tests/unit/test__http.py b/tests/unit/test__http.py index 83de87aae..7ad247ca7 100644 --- a/tests/unit/test__http.py +++ b/tests/unit/test__http.py @@ -49,10 +49,19 @@ def test_default_url(self): self.assertIs(conn._client, client) def test_build_api_url_w_custom_endpoint(self): + from six.moves.urllib.parse import parse_qsl + from six.moves.urllib.parse import urlsplit + custom_endpoint = "https://foo-logging.googleapis.com" conn = self._make_one(object(), api_endpoint=custom_endpoint) - URI = "/".join([custom_endpoint, conn.API_VERSION, "foo"]) - self.assertEqual(conn.build_api_url("/foo"), URI) + uri = conn.build_api_url("/foo") + scheme, netloc, path, qs, _ = urlsplit(uri) + self.assertEqual("%s://%s" % (scheme, netloc), custom_endpoint) + self.assertEqual(path, "/".join(["", conn.API_VERSION, "foo"])) + parms = dict(parse_qsl(qs)) + pretty_print = parms.pop("prettyPrint", "false") + self.assertEqual(pretty_print, "false") + self.assertEqual(parms, {}) def test_extra_headers(self): import requests