changing the test around
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f2631067 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f2631067 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f2631067 Branch: refs/heads/trunk Commit: f263106797994e4b5add5266fa56c2cf6da87fe4 Parents: 03b666f Author: andy <andymahe...@gmail.com> Authored: Tue Jun 13 21:40:52 2017 -0400 Committer: andy <andymahe...@gmail.com> Committed: Tue Jun 13 21:40:52 2017 -0400 ---------------------------------------------------------------------- libcloud/test/container/test_gke.py | 54 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f2631067/libcloud/test/container/test_gke.py ---------------------------------------------------------------------- diff --git a/libcloud/test/container/test_gke.py b/libcloud/test/container/test_gke.py index dfe7881..5b68de9 100644 --- a/libcloud/test/container/test_gke.py +++ b/libcloud/test/container/test_gke.py @@ -13,26 +13,48 @@ # See the License for the specific language governing permissions and # limitations under the License. -from libcloud.test import unittest +import datetime +import mock +import sys +import unittest -from libcloud.container.drivers.gke import GKEContainerDriver -from libcloud.test.secrets import CONTAINER_PARAMS_DOCKER +from libcloud.utils.py3 import httplib +from libcloud.compute.drivers.gce import ( + GCENodeDriver, API_VERSION, timestamp_to_datetime, GCEAddress, GCEBackend, + GCEBackendService, GCEFirewall, GCEForwardingRule, GCEHealthCheck, + GCENetwork, GCENodeImage, GCERoute, GCERegion, GCETargetHttpProxy, + GCEUrlMap, GCEZone, GCESubnetwork) +from libcloud.common.google import (GoogleBaseAuthConnection, + ResourceNotFoundError, ResourceExistsError, + GoogleBaseError) +from libcloud.test.common.test_google import GoogleAuthMockHttp, GoogleTestCase +from libcloud.compute.base import Node, StorageVolume +from libcloud.test import MockHttp +from libcloud.test.compute import TestCaseMixin +from libcloud.test.file_fixtures import ComputeFileFixtures -from libcloud.test.container.test_kubernetes import KubernetesContainerDriverTestCase, KubernetesMockHttp +from libcloud.test.secrets import GCE_PARAMS, GCE_KEYWORD_PARAMS -class GKEContainerDriverTestCase(KubernetesContainerDriverTestCase, unittest.TestCase): +class GKEContainerDriverTestCase(GoogleTestCase, TestCaseMixin): + """ + Google Compute Engine Test Class. + """ + # Mock out a few specific calls that interact with the user, system or + # environment. + GCEZone._now = lambda x: datetime.datetime(2013, 6, 26, 19, 0, 0) + datacenter = 'us-central1-a' def setUp(self): - # Create a test driver for each version - versions = ('linux_124', 'mac_124') - self.drivers = [] - for version in versions: - GKEContainerDriver.connectionCls.conn_class = \ - KubernetesMockHttp - KubernetesMockHttp.type = None - KubernetesMockHttp.use_param = 'a' - driver = GKEContainerDriver(*CONTAINER_PARAMS_DOCKER) - driver.version = version - self.drivers.append(driver) + GCEMockHttp.test = self + GCENodeDriver.connectionCls.conn_class = GCEMockHttp + GoogleBaseAuthConnection.conn_class = GoogleAuthMockHttp + GCEMockHttp.type = None + kwargs = GCE_KEYWORD_PARAMS.copy() + kwargs['auth_type'] = 'IA' + kwargs['datacenter'] = self.datacenter + self.driver = GCENodeDriver(*GCE_PARAMS, **kwargs) + + def test_default_scopes(self): + self.assertEqual(self.driver.scopes, None)