You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/12/13 11:14:53 UTC

[libcloud] 02/04: Add a test case for valid regions for the DigitalOcean spaces driver.

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 164036fb64ac4d9408e2c252abc427ee6fbfd03a
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Dec 13 12:00:53 2020 +0100

    Add a test case for valid regions for the DigitalOcean spaces driver.
---
 libcloud/test/storage/test_digitalocean_spaces.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libcloud/test/storage/test_digitalocean_spaces.py b/libcloud/test/storage/test_digitalocean_spaces.py
index 34814c3..116d36a 100644
--- a/libcloud/test/storage/test_digitalocean_spaces.py
+++ b/libcloud/test/storage/test_digitalocean_spaces.py
@@ -22,7 +22,8 @@ from libcloud.storage.base import Container, Object
 from libcloud.storage.drivers.digitalocean_spaces import (
     DigitalOceanSpacesStorageDriver,
     DOSpacesConnectionAWS4,
-    DOSpacesConnectionAWS2)
+    DOSpacesConnectionAWS2,
+    DO_SPACES_HOSTS_BY_REGION)
 
 from libcloud.test import LibcloudTestCase
 from libcloud.test.secrets import STORAGE_S3_PARAMS
@@ -100,6 +101,13 @@ class DigitalOceanSpacesTests_v4(DigitalOceanSpacesTests):
         host = self.driver.connectionCls.host
         self.assertEqual(host, self.default_host)
 
+    def test_valid_regions(self):
+        for region, hostname in DO_SPACES_HOSTS_BY_REGION.items():
+            driver = self.driver_type(*self.driver_args,
+                                      region=region)
+            self.assertEqual(driver.connectionCls.host, hostname)
+            self.assertTrue(driver.connectionCls.host.startswith(region))
+
 
 class DigitalOceanSpacesDoubleInstanceTests(LibcloudTestCase):
     driver_type = DigitalOceanSpacesStorageDriver