diff --git a/libcloud/test/common/test_digitalocean_v2.py b/libcloud/test/common/test_digitalocean_v2.py index 0f39e9ceee..957f7a66bc 100644 --- a/libcloud/test/common/test_digitalocean_v2.py +++ b/libcloud/test/common/test_digitalocean_v2.py @@ -22,7 +22,6 @@ from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS from libcloud.test.file_fixtures import FileFixtures from libcloud.common.digitalocean import DigitalOceanBaseDriver, DigitalOcean_v2_BaseDriver -from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver class DigitalOceanTests(LibcloudTestCase): @@ -32,6 +31,10 @@ def setUp(self): DigitalOceanCommonMockHttp.type = None self.driver = DigitalOceanBaseDriver(*DIGITALOCEAN_v2_PARAMS) + def tearDown(self): + LibcloudConnection.type = None + DigitalOceanCommonMockHttp.type = None + def test_authentication(self): DigitalOceanCommonMockHttp.type = "UNAUTHORIZED" self.assertRaises(InvalidCredsError, self.driver.ex_account_info) diff --git a/libcloud/test/compute/test_digitalocean_v2.py b/libcloud/test/compute/test_digitalocean_v2.py index 310f2e7788..7ff55ce881 100644 --- a/libcloud/test/compute/test_digitalocean_v2.py +++ b/libcloud/test/compute/test_digitalocean_v2.py @@ -24,8 +24,15 @@ from libcloud.test.secrets import DIGITALOCEAN_v1_PARAMS, DIGITALOCEAN_v2_PARAMS from libcloud.utils.iso8601 import UTC from libcloud.test.file_fixtures import ComputeFileFixtures -from libcloud.common.digitalocean import DigitalOcean_v1_Error -from libcloud.compute.drivers.digitalocean import DigitalOceanNodeDriver +from libcloud.common.digitalocean import ( + DigitalOcean_v1_Error, + DigitalOceanBaseDriver, + DigitalOcean_v2_BaseDriver, +) +from libcloud.compute.drivers.digitalocean import ( + DigitalOceanNodeDriver, + DigitalOcean_v2_NodeDriver, +) try: import simplejson as json @@ -36,10 +43,17 @@ # class DigitalOceanTests(unittest.TestCase, TestCaseMixin): class DigitalOcean_v2_Tests(LibcloudTestCase): def setUp(self): + DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp + DigitalOcean_v2_BaseDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp DigitalOceanNodeDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp + DigitalOcean_v2_NodeDriver.connectionCls.conn_class = DigitalOceanComputeMockHttp DigitalOceanComputeMockHttp.type = None self.driver = DigitalOceanNodeDriver(*DIGITALOCEAN_v2_PARAMS) + def tearDown(self): + LibcloudConnection.type = None + DigitalOceanComputeMockHttp.type = None + def test_v1_Error(self): self.assertRaises( DigitalOcean_v1_Error, diff --git a/libcloud/test/dns/test_digitalocean.py b/libcloud/test/dns/test_digitalocean.py index 952c060acf..2b2118b385 100644 --- a/libcloud/test/dns/test_digitalocean.py +++ b/libcloud/test/dns/test_digitalocean.py @@ -21,15 +21,22 @@ from libcloud.utils.py3 import httplib from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS from libcloud.test.file_fixtures import DNSFileFixtures +from libcloud.common.digitalocean import DigitalOceanBaseDriver, DigitalOcean_v2_BaseDriver from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver class DigitalOceanDNSTests(LibcloudTestCase): def setUp(self): + DigitalOceanBaseDriver.connectionCls.conn_class = DigitalOceanDNSMockHttp + DigitalOcean_v2_BaseDriver.connectionCls.conn_class = DigitalOceanDNSMockHttp DigitalOceanDNSDriver.connectionCls.conn_class = DigitalOceanDNSMockHttp DigitalOceanDNSMockHttp.type = None self.driver = DigitalOceanDNSDriver(*DIGITALOCEAN_v2_PARAMS) + def tearDown(self): + LibcloudConnection.type = None + DigitalOceanDNSMockHttp.type = None + def test_list_zones(self): zones = self.driver.list_zones() self.assertTrue(len(zones) >= 1)