Skip to content

Commit

Permalink
Also clean up / rest DigitalOcean mock http classes as part of tearDown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed Apr 16, 2024
1 parent 6ba2819 commit 0562748
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libcloud/test/common/test_digitalocean_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions libcloud/test/compute/test_digitalocean_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def setUp(self):
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,
Expand Down
4 changes: 4 additions & 0 deletions libcloud/test/dns/test_digitalocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def setUp(self):
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)
Expand Down

0 comments on commit 0562748

Please sign in to comment.