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 2019/07/19 21:04:49 UTC

[libcloud] 05/08: Add missing test fixtures.

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 d63de53644aad61fdddaa312fd7343cee2f552d9
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jul 19 22:56:43 2019 +0200

    Add missing test fixtures.
---
 libcloud/compute/drivers/azure_arm.py               |  2 +-
 ...ft_Network_publicIPAddresses_test_public_ip.json | 21 +++++++++++++++++++++
 ...Microsoft_Network_publicIPAddresses_test_ip.json |  1 +
 libcloud/test/compute/test_azure_arm.py             |  8 +++++---
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index fa685e8..63a2473 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -1882,7 +1882,7 @@ class AzureNodeDriver(NodeDriver):
             },
         )
 
-        return r.object
+        return r.status in [200, 202, 204]
 
     def ex_create_network_interface(self, name, subnet, resource_group,
                                     location=None, public_ip=None):
diff --git a/libcloud/test/compute/fixtures/azure_arm/_subscriptions_99999999_resourceGroups_REVIZOR_providers_Microsoft_Network_publicIPAddresses_test_public_ip.json b/libcloud/test/compute/fixtures/azure_arm/_subscriptions_99999999_resourceGroups_REVIZOR_providers_Microsoft_Network_publicIPAddresses_test_public_ip.json
new file mode 100644
index 0000000..c6b642c
--- /dev/null
+++ b/libcloud/test/compute/fixtures/azure_arm/_subscriptions_99999999_resourceGroups_REVIZOR_providers_Microsoft_Network_publicIPAddresses_test_public_ip.json
@@ -0,0 +1,21 @@
+{
+  "name": "testDNS-ip",
+  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip",
+  "location": "westus",
+  "zones": [
+    "1"
+  ],
+  "properties": {
+    "provisioningState": "Succeeded",
+    "publicIPAddressVersion": "IPv4",
+    "publicIPAllocationMethod": "Static",
+    "idleTimeoutInMinutes": 10,
+    "ipConfiguration": {
+      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testDNS649/ipConfigurations/ipconfig1"
+    }
+  },
+  "sku": {
+    "name": "Standard"
+  },
+  "type": "Microsoft.Network/publicIPAddresses"
+}
diff --git a/libcloud/test/compute/fixtures/azure_arm/_subscriptions_subid_resourceGroups_rg1_providers_Microsoft_Network_publicIPAddresses_test_ip.json b/libcloud/test/compute/fixtures/azure_arm/_subscriptions_subid_resourceGroups_rg1_providers_Microsoft_Network_publicIPAddresses_test_ip.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/libcloud/test/compute/fixtures/azure_arm/_subscriptions_subid_resourceGroups_rg1_providers_Microsoft_Network_publicIPAddresses_test_ip.json
@@ -0,0 +1 @@
+{}
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index c613490..0f65d87 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -441,7 +441,7 @@ class AzureNodeDriverTests(LibcloudTestCase):
         )
         new_size = volume.size
 
-        self.assertEqual(new_size , original_size + 8)
+        self.assertEqual(new_size, original_size + 8)
 
     def test_detach_volume(self):
         volumes = self.driver.list_volumes()
@@ -564,10 +564,12 @@ class AzureNodeDriverTests(LibcloudTestCase):
         snapshot = self.driver.list_snapshots()[0]
         res_value = snapshot.destroy()
         self.assertTrue(res_value)
-    
+
     def test_delete_public_ip(self):
         location = self.driver.list_locations()[0]
-        public_ip = self.driver.ex_create_public_ip(name='test_public_ip', resource_group='REVIZOR', location=location)
+        public_ip = self.driver.ex_create_public_ip(name='test_public_ip',
+                                                    resource_group='REVIZOR',
+                                                    location=location)
         res_value = self.driver.ex_delete_public_ip(public_ip)
         self.assertTrue(res_value)