Content-Length: 357297 | pFad | http://github.com/googleapis/python-dns/commit/47f8458553d42adbc9aa2c78bfdf002ed26d582a

BB test: update tests to support latest google-cloud-core (#23) · googleapis/python-dns@47f8458 · GitHub
Skip to content

Commit 47f8458

Browse files
authored
test: update tests to support latest google-cloud-core (#23)
* test: update tests to support latest google-cloud-core `google-cloud-core` version 1.4.2 populates `prettyPrint=false` by default. Update the connection tests to expect a value for `prettyPrint`.
1 parent 1b75bde commit 47f8458

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

tests/unit/test__http.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,33 @@ def _make_one(self, *args, **kw):
2828
return self._get_target_class()(*args, **kw)
2929

3030
def test_build_api_url_no_extra_query_params(self):
31+
from six.moves.urllib.parse import parse_qsl
32+
from six.moves.urllib.parse import urlsplit
33+
3134
conn = self._make_one(object())
32-
URI = "/".join([conn.API_BASE_URL, "dns", conn.API_VERSION, "foo"])
33-
self.assertEqual(conn.build_api_url("/foo"), URI)
35+
uri = conn.build_api_url("/foo")
36+
scheme, netloc, path, qs, _ = urlsplit(uri)
37+
self.assertEqual("%s://%s" % (scheme, netloc), conn.API_BASE_URL)
38+
self.assertEqual(path, "/".join(["", "dns", conn.API_VERSION, "foo"]))
39+
parms = dict(parse_qsl(qs))
40+
pretty_print = parms.pop("prettyPrint", "false")
41+
self.assertEqual(pretty_print, "false")
42+
self.assertEqual(parms, {})
43+
44+
def test_build_api_url_w_custom_endpoint(self):
45+
from six.moves.urllib.parse import parse_qsl
46+
from six.moves.urllib.parse import urlsplit
47+
48+
custom_endpoint = "https://foo-dns.googleapis.com"
49+
conn = self._make_one(object(), api_endpoint=custom_endpoint)
50+
uri = conn.build_api_url("/foo")
51+
scheme, netloc, path, qs, _ = urlsplit(uri)
52+
self.assertEqual("%s://%s" % (scheme, netloc), custom_endpoint)
53+
self.assertEqual(path, "/".join(["", "dns", conn.API_VERSION, "foo"]))
54+
parms = dict(parse_qsl(qs))
55+
pretty_print = parms.pop("prettyPrint", "false")
56+
self.assertEqual(pretty_print, "false")
57+
self.assertEqual(parms, {})
3458

3559
def test_build_api_url_w_extra_query_params(self):
3660
from six.moves.urllib.parse import parse_qsl
@@ -44,12 +68,6 @@ def test_build_api_url_w_extra_query_params(self):
4468
parms = dict(parse_qsl(qs))
4569
self.assertEqual(parms["bar"], "baz")
4670

47-
def test_build_api_url_w_custom_endpoint(self):
48-
custom_endpoint = "https://foo-dns.googleapis.com"
49-
conn = self._make_one(object(), api_endpoint=custom_endpoint)
50-
URI = "/".join([custom_endpoint, "dns", conn.API_VERSION, "foo"])
51-
self.assertEqual(conn.build_api_url("/foo"), URI)
52-
5371
def test_extra_headers(self):
5472
import requests
5573
from google.cloud import _http as base_http

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/python-dns/commit/47f8458553d42adbc9aa2c78bfdf002ed26d582a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy