You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by qu...@apache.org on 2018/02/25 05:02:56 UTC

[4/8] libcloud git commit: Add test for internal ip creation for GCP

Add test for internal ip creation for GCP

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


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

Branch: refs/heads/trunk
Commit: 7a5abfa9de3c9442a7db189bbd1f662b80c680cf
Parents: efb296d
Author: Jeremy Solarz <js...@google.com>
Authored: Fri Feb 23 19:06:31 2018 +0000
Committer: Quentin Pradet <qu...@apache.org>
Committed: Sun Feb 25 09:00:55 2018 +0400

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7a5abfa9/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index f9e33ff..82a2e64 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -735,6 +735,19 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
         self.assertTrue(isinstance(address, GCEAddress))
         self.assertEqual(address.name, address_name)
 
+    def test_ex_create_address_internal(self):
+        address_name = 'lcaddressinternal'
+        address = self.driver.ex_create_address(address_name,
+                                                region='us-central1',
+                                                address='10.128.0.12',
+                                                address_type='INTERNAL',
+                                                subnetwork='subnet-1')
+        print address
+        self.assertTrue(isinstance(address, GCEAddress))
+        self.assertEqual(address.name, address_name)
+        self.assertEqual(address.address, '10.128.0.12')
+        self.assertEqual(address.addressType, 'INTERNAL')
+
     def test_ex_create_backend(self):
         # Note: this is an internal object, no API call is made
         # and no fixture is needed specifically for GCEBackend, however
@@ -3011,6 +3024,16 @@ class GCEMockHttp(MockHttp):
         body = self.fixtures.load('regions_us-central1_addresses_testaddress.json')
         return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
 
+    def _regions_us_central1_subnetworks_subnet_1(self, method, url, body,
+                                                  headers):
+        body = self.fixtures.load('regions_us-central1_subnetworks_subnet_1.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
+    def _regions_us_central1_addresses_lcaddressinternal(self, method, url, body,
+                                                         headers):
+        body = self.fixtures.load('regions_us-central1_addresses_lcaddressinternal.json')
+        return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK])
+
     def _regions_us_central1_forwardingRules(self, method, url, body, headers):
         if method == 'POST':
             body = self.fixtures.load(