libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quent...@apache.org
Subject [8/9] libcloud git commit: Adding tests for get_network and get_subnetwork
Date Fri, 19 Jan 2018 20:25:16 GMT
Adding tests for get_network and get_subnetwork

Signed-off-by: Quentin Pradet <quentinp@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0abf0f2d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0abf0f2d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0abf0f2d

Branch: refs/heads/trunk
Commit: 0abf0f2d90e1a91b98e55118a2d72348088a8cf5
Parents: 7d2f353
Author: Boris Chazalet <bchazalet@companywatch.net>
Authored: Fri Jan 19 10:43:21 2018 +0100
Committer: Quentin Pradet <quentinp@apache.org>
Committed: Sat Jan 20 00:22:53 2018 +0400

----------------------------------------------------------------------
 libcloud/test/compute/test_gce.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0abf0f2d/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index 3c38b98..14abcc0 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -556,6 +556,12 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
         # fetch by region object
         subnetwork = self.driver.ex_get_subnetwork(name, region)
         self.assertEqual(subnetwork.name, name)
+        # do the same but this time by resource URL
+        url = 'https://www.googleapis.com/compute/v1/projects/project_name/regions/us-central1/subnetworks/cf-972cf02e6ad49112'
+        # fetch by no region
+        subnetwork = self.driver.ex_get_subnetwork(url)
+        self.assertEqual(subnetwork.name, name)
+        self.assertEqual(subnetwork.region.name, region_name)
 
     def test_ex_list_networks(self):
         networks = self.driver.ex_list_networks()
@@ -1746,6 +1752,13 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
         self.assertEqual(network.cidr, '10.11.0.0/16')
         self.assertEqual(network.extra['gatewayIPv4'], '10.11.0.1')
         self.assertEqual(network.extra['description'], 'A custom network')
+        # do the same but this time with URL
+        url = 'https://www.googleapis.com/compute/v1/projects/project_name/global/networks/lcnetwork'
+        network = self.driver.ex_get_network(network_name)
+        self.assertEqual(network.name, network_name)
+        self.assertEqual(network.cidr, '10.11.0.0/16')
+        self.assertEqual(network.extra['gatewayIPv4'], '10.11.0.1')
+        self.assertEqual(network.extra['description'], 'A custom network')
 
     def test_ex_get_node(self):
         node_name = 'node-name'


Mime
View raw message