diff --git a/dns/google/cloud/dns/__init__.py b/dns/google/cloud/dns/__init__.py index 9d456e16257c..5a8e5c388022 100644 --- a/dns/google/cloud/dns/__init__.py +++ b/dns/google/cloud/dns/__init__.py @@ -27,7 +27,6 @@ from google.cloud.dns.zone import Changes from google.cloud.dns.client import Client -from google.cloud.dns.connection import Connection from google.cloud.dns.zone import ManagedZone from google.cloud.dns.resource_record_set import ResourceRecordSet diff --git a/dns/google/cloud/dns/connection.py b/dns/google/cloud/dns/_http.py similarity index 100% rename from dns/google/cloud/dns/connection.py rename to dns/google/cloud/dns/_http.py diff --git a/dns/google/cloud/dns/client.py b/dns/google/cloud/dns/client.py index 22f72dfb32b4..b5491fdb8f55 100644 --- a/dns/google/cloud/dns/client.py +++ b/dns/google/cloud/dns/client.py @@ -16,7 +16,8 @@ from google.cloud.client import ClientWithProject -from google.cloud.dns.connection import Connection + +from google.cloud.dns._http import Connection from google.cloud.dns.zone import ManagedZone from google.cloud.iterator import HTTPIterator diff --git a/dns/unit_tests/test_connection.py b/dns/unit_tests/test__http.py similarity index 96% rename from dns/unit_tests/test_connection.py rename to dns/unit_tests/test__http.py index 9453483e4a46..ba9173808d75 100644 --- a/dns/unit_tests/test_connection.py +++ b/dns/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.dns.connection import Connection + from google.cloud.dns._http import Connection return Connection diff --git a/dns/unit_tests/test_client.py b/dns/unit_tests/test_client.py index 09b861e15cb6..7521bf9112c8 100644 --- a/dns/unit_tests/test_client.py +++ b/dns/unit_tests/test_client.py @@ -38,7 +38,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_ctor(self): - from google.cloud.dns.connection import Connection + from google.cloud.dns._http import Connection creds = _make_credentials() http = object() diff --git a/docs/dns-client.rst b/docs/dns-client.rst index 337ac6558859..76cbb66f5649 100644 --- a/docs/dns-client.rst +++ b/docs/dns-client.rst @@ -4,10 +4,3 @@ DNS Client .. automodule:: google.cloud.dns.client :members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.dns.connection - :members: - :show-inheritance: diff --git a/docs/language-client.rst b/docs/language-client.rst index c0bc0b329ee0..310e7b5bf828 100644 --- a/docs/language-client.rst +++ b/docs/language-client.rst @@ -4,10 +4,3 @@ Natural Language Client .. automodule:: google.cloud.language.client :members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.language.connection - :members: - :show-inheritance: diff --git a/docs/monitoring-client.rst b/docs/monitoring-client.rst index 1aec72367379..adc83974e6b2 100644 --- a/docs/monitoring-client.rst +++ b/docs/monitoring-client.rst @@ -4,10 +4,3 @@ Stackdriver Monitoring Client .. automodule:: google.cloud.monitoring.client :members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.monitoring.connection - :members: - :show-inheritance: diff --git a/docs/resource-manager-client.rst b/docs/resource-manager-client.rst index 0eb5837f2623..1678f85d7066 100644 --- a/docs/resource-manager-client.rst +++ b/docs/resource-manager-client.rst @@ -8,10 +8,3 @@ Client .. automodule:: google.cloud.resource_manager.client :members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.resource_manager.connection - :members: - :show-inheritance: diff --git a/docs/runtimeconfig-client.rst b/docs/runtimeconfig-client.rst index 215c1511d36e..20775256be84 100644 --- a/docs/runtimeconfig-client.rst +++ b/docs/runtimeconfig-client.rst @@ -4,10 +4,3 @@ Runtime Configuration Client .. automodule:: google.cloud.runtimeconfig.client :members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.runtimeconfig.connection - :members: - :show-inheritance: diff --git a/docs/speech-client.rst b/docs/speech-client.rst index 1e14b24eeac5..4e6caad90ff3 100644 --- a/docs/speech-client.rst +++ b/docs/speech-client.rst @@ -5,11 +5,3 @@ Speech Client :members: :undoc-members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.speech.connection - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/translate-client.rst b/docs/translate-client.rst index 2bb0820ef5dd..9f6aa5e1ece9 100644 --- a/docs/translate-client.rst +++ b/docs/translate-client.rst @@ -5,11 +5,3 @@ Translation Client :members: :undoc-members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.translate.connection - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/vision-client.rst b/docs/vision-client.rst index f7f9fd259ce4..36977d972931 100644 --- a/docs/vision-client.rst +++ b/docs/vision-client.rst @@ -8,11 +8,3 @@ Client :members: :undoc-members: :show-inheritance: - -Connection -~~~~~~~~~~ - -.. automodule:: google.cloud.vision.connection - :members: - :undoc-members: - :show-inheritance: diff --git a/language/google/cloud/language/connection.py b/language/google/cloud/language/_http.py similarity index 100% rename from language/google/cloud/language/connection.py rename to language/google/cloud/language/_http.py diff --git a/language/google/cloud/language/client.py b/language/google/cloud/language/client.py index 4c8380eba2fc..55940063a641 100644 --- a/language/google/cloud/language/client.py +++ b/language/google/cloud/language/client.py @@ -18,7 +18,8 @@ import warnings from google.cloud import client as client_module -from google.cloud.language.connection import Connection + +from google.cloud.language._http import Connection from google.cloud.language.document import Document diff --git a/language/unit_tests/test_connection.py b/language/unit_tests/test__http.py similarity index 94% rename from language/unit_tests/test_connection.py rename to language/unit_tests/test__http.py index f595cc6130aa..496422ee2c8b 100644 --- a/language/unit_tests/test_connection.py +++ b/language/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.language.connection import Connection + from google.cloud.language._http import Connection return Connection diff --git a/language/unit_tests/test_client.py b/language/unit_tests/test_client.py index ee5b61f3ea86..87ad21655414 100644 --- a/language/unit_tests/test_client.py +++ b/language/unit_tests/test_client.py @@ -36,7 +36,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_ctor(self): - from google.cloud.language.connection import Connection + from google.cloud.language._http import Connection creds = make_mock_credentials() http = object() diff --git a/language/unit_tests/test_document.py b/language/unit_tests/test_document.py index ab75c8686349..2ddfc0de97d5 100644 --- a/language/unit_tests/test_document.py +++ b/language/unit_tests/test_document.py @@ -97,7 +97,7 @@ def _get_entities(include_entities): def make_mock_client(response): import mock - from google.cloud.language.connection import Connection + from google.cloud.language._http import Connection from google.cloud.language.client import Client connection = mock.Mock(spec=Connection) diff --git a/monitoring/google/cloud/monitoring/__init__.py b/monitoring/google/cloud/monitoring/__init__.py index 8a350cbc3622..3afbd72baac9 100644 --- a/monitoring/google/cloud/monitoring/__init__.py +++ b/monitoring/google/cloud/monitoring/__init__.py @@ -15,7 +15,6 @@ """Google Stackdriver Monitoring API wrapper.""" from google.cloud.monitoring.client import Client -from google.cloud.monitoring.connection import Connection from google.cloud.monitoring.group import Group from google.cloud.monitoring.label import LabelDescriptor from google.cloud.monitoring.label import LabelValueType @@ -33,7 +32,6 @@ __all__ = ( 'Client', - 'Connection', 'Group', 'LabelDescriptor', 'LabelValueType', 'Metric', 'MetricDescriptor', 'MetricKind', 'ValueType', diff --git a/monitoring/google/cloud/monitoring/connection.py b/monitoring/google/cloud/monitoring/_http.py similarity index 100% rename from monitoring/google/cloud/monitoring/connection.py rename to monitoring/google/cloud/monitoring/_http.py diff --git a/monitoring/google/cloud/monitoring/client.py b/monitoring/google/cloud/monitoring/client.py index 099f16105cec..88052bddd760 100644 --- a/monitoring/google/cloud/monitoring/client.py +++ b/monitoring/google/cloud/monitoring/client.py @@ -32,7 +32,8 @@ from google.cloud._helpers import _datetime_to_rfc3339 from google.cloud.client import ClientWithProject -from google.cloud.monitoring.connection import Connection + +from google.cloud.monitoring._http import Connection from google.cloud.monitoring.group import Group from google.cloud.monitoring.metric import Metric from google.cloud.monitoring.metric import MetricDescriptor @@ -44,6 +45,7 @@ from google.cloud.monitoring.timeseries import Point from google.cloud.monitoring.timeseries import TimeSeries + _UTCNOW = datetime.datetime.utcnow # To be replaced by tests. diff --git a/monitoring/unit_tests/test_connection.py b/monitoring/unit_tests/test__http.py similarity index 93% rename from monitoring/unit_tests/test_connection.py rename to monitoring/unit_tests/test__http.py index 5d56acb40908..6ec4923bbf78 100644 --- a/monitoring/unit_tests/test_connection.py +++ b/monitoring/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.monitoring.connection import Connection + from google.cloud.monitoring._http import Connection return Connection diff --git a/resource_manager/google/cloud/resource_manager/__init__.py b/resource_manager/google/cloud/resource_manager/__init__.py index 9b172f4f3223..65a45126b52b 100644 --- a/resource_manager/google/cloud/resource_manager/__init__.py +++ b/resource_manager/google/cloud/resource_manager/__init__.py @@ -16,7 +16,6 @@ from google.cloud.resource_manager.client import Client -from google.cloud.resource_manager.connection import Connection from google.cloud.resource_manager.project import Project diff --git a/resource_manager/google/cloud/resource_manager/connection.py b/resource_manager/google/cloud/resource_manager/_http.py similarity index 100% rename from resource_manager/google/cloud/resource_manager/connection.py rename to resource_manager/google/cloud/resource_manager/_http.py diff --git a/resource_manager/google/cloud/resource_manager/client.py b/resource_manager/google/cloud/resource_manager/client.py index e1258ea1af70..83623d4f6629 100644 --- a/resource_manager/google/cloud/resource_manager/client.py +++ b/resource_manager/google/cloud/resource_manager/client.py @@ -17,7 +17,8 @@ from google.cloud.client import Client as BaseClient from google.cloud.iterator import HTTPIterator -from google.cloud.resource_manager.connection import Connection + +from google.cloud.resource_manager._http import Connection from google.cloud.resource_manager.project import Project diff --git a/resource_manager/unit_tests/test_connection.py b/resource_manager/unit_tests/test__http.py similarity index 95% rename from resource_manager/unit_tests/test_connection.py rename to resource_manager/unit_tests/test__http.py index 59747cd0541b..f9204492eeac 100644 --- a/resource_manager/unit_tests/test_connection.py +++ b/resource_manager/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.resource_manager.connection import Connection + from google.cloud.resource_manager._http import Connection return Connection diff --git a/resource_manager/unit_tests/test_client.py b/resource_manager/unit_tests/test_client.py index 4425e76c5f9f..0b9535cf34b8 100644 --- a/resource_manager/unit_tests/test_client.py +++ b/resource_manager/unit_tests/test_client.py @@ -35,7 +35,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_constructor(self): - from google.cloud.resource_manager.connection import Connection + from google.cloud.resource_manager._http import Connection http = object() credentials = _make_credentials() diff --git a/runtimeconfig/google/cloud/runtimeconfig/connection.py b/runtimeconfig/google/cloud/runtimeconfig/_http.py similarity index 100% rename from runtimeconfig/google/cloud/runtimeconfig/connection.py rename to runtimeconfig/google/cloud/runtimeconfig/_http.py diff --git a/runtimeconfig/google/cloud/runtimeconfig/client.py b/runtimeconfig/google/cloud/runtimeconfig/client.py index 1f40b62895a5..11eb488a7081 100644 --- a/runtimeconfig/google/cloud/runtimeconfig/client.py +++ b/runtimeconfig/google/cloud/runtimeconfig/client.py @@ -16,7 +16,8 @@ from google.cloud.client import ClientWithProject -from google.cloud.runtimeconfig.connection import Connection + +from google.cloud.runtimeconfig._http import Connection from google.cloud.runtimeconfig.config import Config diff --git a/runtimeconfig/unit_tests/test_connection.py b/runtimeconfig/unit_tests/test__http.py similarity index 93% rename from runtimeconfig/unit_tests/test_connection.py rename to runtimeconfig/unit_tests/test__http.py index c89465fc0603..995f609a5a5a 100644 --- a/runtimeconfig/unit_tests/test_connection.py +++ b/runtimeconfig/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.runtimeconfig.connection import Connection + from google.cloud.runtimeconfig._http import Connection return Connection diff --git a/speech/google/cloud/speech/__init__.py b/speech/google/cloud/speech/__init__.py index 2d0ba94b738c..0c4f7542e02f 100644 --- a/speech/google/cloud/speech/__init__.py +++ b/speech/google/cloud/speech/__init__.py @@ -16,6 +16,5 @@ from google.cloud.speech.alternative import Alternative from google.cloud.speech.client import Client -from google.cloud.speech.connection import Connection from google.cloud.speech.encoding import Encoding from google.cloud.speech.operation import Operation diff --git a/speech/google/cloud/speech/_http.py b/speech/google/cloud/speech/_http.py index f8bd209bf2c4..a4755f6f89ff 100644 --- a/speech/google/cloud/speech/_http.py +++ b/speech/google/cloud/speech/_http.py @@ -18,11 +18,29 @@ from google.cloud._helpers import _bytes_to_unicode from google.cloud._helpers import _to_bytes +from google.cloud import _http from google.cloud.speech.result import Result from google.cloud.speech.operation import Operation +class Connection(_http.JSONConnection): + """A connection to Google Cloud Speech JSON REST API. + + :type client: :class:`~google.cloud.speech.client.Client` + :param client: The client that owns the current connection. + """ + + API_BASE_URL = 'https://speech.googleapis.com' + """The base of the API call URL.""" + + API_VERSION = 'v1beta1' + """The version of the API, used in building the API call's URL.""" + + API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' + """A template for the URL of a particular API call.""" + + class HTTPSpeechAPI(object): """Speech API for interacting with the HTTP version of the API. diff --git a/speech/google/cloud/speech/client.py b/speech/google/cloud/speech/client.py index 2ae34784558b..f534ab63d1b4 100644 --- a/speech/google/cloud/speech/client.py +++ b/speech/google/cloud/speech/client.py @@ -20,8 +20,8 @@ from google.cloud.environment_vars import DISABLE_GRPC from google.cloud.speech._gax import GAPICSpeechAPI +from google.cloud.speech._http import Connection from google.cloud.speech._http import HTTPSpeechAPI -from google.cloud.speech.connection import Connection from google.cloud.speech.sample import Sample diff --git a/speech/google/cloud/speech/connection.py b/speech/google/cloud/speech/connection.py deleted file mode 100644 index 0067cc0aae7d..000000000000 --- a/speech/google/cloud/speech/connection.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Create / interact with Google Cloud Speech connections.""" - -from google.cloud import _http - - -class Connection(_http.JSONConnection): - """A connection to Google Cloud Speech JSON REST API. - - :type client: :class:`~google.cloud.speech.client.Client` - :param client: The client that owns the current connection. - """ - - API_BASE_URL = 'https://speech.googleapis.com' - """The base of the API call URL.""" - - API_VERSION = 'v1beta1' - """The version of the API, used in building the API call's URL.""" - - API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' - """A template for the URL of a particular API call.""" diff --git a/speech/unit_tests/test_connection.py b/speech/unit_tests/test__http.py similarity index 94% rename from speech/unit_tests/test_connection.py rename to speech/unit_tests/test__http.py index f7b2d618b831..fec987a07f37 100644 --- a/speech/unit_tests/test_connection.py +++ b/speech/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.speech.connection import Connection + from google.cloud.speech._http import Connection return Connection diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index b8a87e8b0b55..03c348a8165f 100644 --- a/speech/unit_tests/test_client.py +++ b/speech/unit_tests/test_client.py @@ -85,7 +85,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_ctor(self): - from google.cloud.speech.connection import Connection + from google.cloud.speech._http import Connection creds = _make_credentials() http = object() diff --git a/translate/google/cloud/translate/__init__.py b/translate/google/cloud/translate/__init__.py index 006ac866ab8d..efcb64eff8fe 100644 --- a/translate/google/cloud/translate/__init__.py +++ b/translate/google/cloud/translate/__init__.py @@ -17,4 +17,3 @@ from google.cloud.translate.client import BASE from google.cloud.translate.client import Client from google.cloud.translate.client import NMT -from google.cloud.translate.connection import Connection diff --git a/translate/google/cloud/translate/connection.py b/translate/google/cloud/translate/_http.py similarity index 100% rename from translate/google/cloud/translate/connection.py rename to translate/google/cloud/translate/_http.py diff --git a/translate/google/cloud/translate/client.py b/translate/google/cloud/translate/client.py index 12e64c403f5e..b1cdbcbfe859 100644 --- a/translate/google/cloud/translate/client.py +++ b/translate/google/cloud/translate/client.py @@ -19,7 +19,8 @@ from google.cloud._helpers import _to_bytes from google.cloud.client import Client as BaseClient -from google.cloud.translate.connection import Connection + +from google.cloud.translate._http import Connection ENGLISH_ISO_639 = 'en' diff --git a/translate/unit_tests/test_connection.py b/translate/unit_tests/test__http.py similarity index 96% rename from translate/unit_tests/test_connection.py rename to translate/unit_tests/test__http.py index e7c9e58ea6f3..031fc2f0a3bb 100644 --- a/translate/unit_tests/test_connection.py +++ b/translate/unit_tests/test__http.py @@ -19,7 +19,7 @@ class TestConnection(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.translate.connection import Connection + from google.cloud.translate._http import Connection return Connection diff --git a/translate/unit_tests/test_client.py b/translate/unit_tests/test_client.py index 5a10022bb895..749ab0e60276 100644 --- a/translate/unit_tests/test_client.py +++ b/translate/unit_tests/test_client.py @@ -27,7 +27,7 @@ def _make_one(self, *args, **kw): return self._get_target_class()(*args, **kw) def test_constructor(self): - from google.cloud.translate.connection import Connection + from google.cloud.translate._http import Connection from google.cloud.translate.client import ENGLISH_ISO_639 http = object() @@ -38,7 +38,7 @@ def test_constructor(self): self.assertEqual(client.target_language, ENGLISH_ISO_639) def test_constructor_non_default(self): - from google.cloud.translate.connection import Connection + from google.cloud.translate._http import Connection http = object() target = 'es' diff --git a/vision/google/cloud/vision/__init__.py b/vision/google/cloud/vision/__init__.py index e33a7c5fe42e..8a60ee566968 100644 --- a/vision/google/cloud/vision/__init__.py +++ b/vision/google/cloud/vision/__init__.py @@ -13,4 +13,5 @@ # limitations under the License. """Google Cloud Vision API package.""" + from google.cloud.vision.client import Client diff --git a/vision/google/cloud/vision/_http.py b/vision/google/cloud/vision/_http.py index 35d9c76ef8c6..e3a0627c80ac 100644 --- a/vision/google/cloud/vision/_http.py +++ b/vision/google/cloud/vision/_http.py @@ -14,10 +14,29 @@ """HTTP Client for interacting with the Google Cloud Vision API.""" +from google.cloud import _http + from google.cloud.vision.annotations import Annotations from google.cloud.vision.feature import Feature +class Connection(_http.JSONConnection): + """A connection to Google Cloud Vision via the JSON REST API. + + :type client: :class:`~google.cloud.vision.client.Client` + :param client: The client that owns the current connection. + """ + + API_BASE_URL = 'https://vision.googleapis.com' + """The base of the API call URL.""" + + API_VERSION = 'v1' + """The version of the API, used in building the API call's URL.""" + + API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}' + """A template for the URL of a particular API call.""" + + class _HTTPVisionAPI(object): """Vision API for interacting with the JSON/HTTP version of Vision diff --git a/vision/google/cloud/vision/client.py b/vision/google/cloud/vision/client.py index 1fdc00ad81a7..99a7664953ee 100644 --- a/vision/google/cloud/vision/client.py +++ b/vision/google/cloud/vision/client.py @@ -20,10 +20,10 @@ from google.cloud.environment_vars import DISABLE_GRPC from google.cloud.vision._gax import _GAPICVisionAPI +from google.cloud.vision._http import _HTTPVisionAPI +from google.cloud.vision._http import Connection from google.cloud.vision.batch import Batch -from google.cloud.vision.connection import Connection from google.cloud.vision.image import Image -from google.cloud.vision._http import _HTTPVisionAPI _USE_GAX = not os.getenv(DISABLE_GRPC, False) diff --git a/vision/google/cloud/vision/connection.py b/vision/google/cloud/vision/connection.py deleted file mode 100644 index 7983c93eceea..000000000000 --- a/vision/google/cloud/vision/connection.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2016 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -"""Create / interact with Google Cloud Vision connections.""" - - -from google.cloud import _http - - -class Connection(_http.JSONConnection): - """A connection to Google Cloud Vision via the JSON REST API. - - :type client: :class:`~google.cloud.vision.client.Client` - :param client: The client that owns the current connection. - """ - - API_BASE_URL = 'https://vision.googleapis.com' - """The base of the API call URL.""" - - API_VERSION = 'v1' - """The version of the API, used in building the API call's URL.""" - - API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}' - """A template for the URL of a particular API call.""" diff --git a/vision/unit_tests/test__http.py b/vision/unit_tests/test__http.py index e0eb690352b0..e1fd82e57b19 100644 --- a/vision/unit_tests/test__http.py +++ b/vision/unit_tests/test__http.py @@ -23,6 +23,22 @@ B64_IMAGE_CONTENT = base64.b64encode(IMAGE_CONTENT).decode('ascii') +class TestConnection(unittest.TestCase): + + @staticmethod + def _get_target_class(): + from google.cloud.vision._http import Connection + return Connection + + def _make_one(self, *args, **kw): + return self._get_target_class()(*args, **kw) + + def test_default_url(self): + client = object() + conn = self._make_one(client) + self.assertEqual(conn._client, client) + + class Test_HTTPVisionAPI(unittest.TestCase): def _get_target_class(self): from google.cloud.vision._http import _HTTPVisionAPI diff --git a/vision/unit_tests/test_connection.py b/vision/unit_tests/test_connection.py deleted file mode 100644 index 042784336c59..000000000000 --- a/vision/unit_tests/test_connection.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2016 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest - - -class TestConnection(unittest.TestCase): - - @staticmethod - def _get_target_class(): - from google.cloud.vision.connection import Connection - return Connection - - def _make_one(self, *args, **kw): - return self._get_target_class()(*args, **kw) - - def test_default_url(self): - client = object() - conn = self._make_one(client) - self.assertEqual(conn._client, client)