fog-azure-rm 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9de926983a22144f9743089245c227abdf6e4b052036f4e90a0683e252695fa
4
- data.tar.gz: 70951e0a5a6b35713e36918738a1c6023ed816dd7e87245d34a275f8e5c18d80
3
+ metadata.gz: b6eace092703425619fcb56d16c63043e2f92be194dbe41d800702afb6f03238
4
+ data.tar.gz: dbeacbf137a189c567e97e2c6b459b6d6e4fc5edde87a7d1a674c48059e7d975
5
5
  SHA512:
6
- metadata.gz: c8ad7a53b6f0ae4a8370dc4bcf2023d4d0c32c23328aed73d38a841a4fac040d39f2a83a30ec2faece79c929f384e967c03e96d08895758391d2592ce69d95f8
7
- data.tar.gz: 32456f0bfa1599938f7549bb4e572db4f39a0fc3493bd981d0c86340055eeb77132012e21127906b635255e9745bec7e7a2ad47332f6ddf385b33665315a9ff1
6
+ metadata.gz: e18b3f6b29b0e8ebe819650977bd7bc06a37efab2191ef1bbc07761e22dad7ebe651b4b6eb282ef5146d4e388cb8183511e8e0ae0a87bcfde8f232b16d485d70
7
+ data.tar.gz: b746e050e5e78944ed72644b23c506bbd0e5d7f71830d6207bcf54d9f59c5d48e45fd8334bdf40ce3514894cde942fd2b2625db4ae280fd31a7a7e47e7ccd04f
data/.travis.yml CHANGED
@@ -2,8 +2,8 @@ language: ruby
2
2
  sudo: false
3
3
 
4
4
  before_install:
5
- - gem install bundler
6
- - gem update bundler
5
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
6
+ - gem install bundler -v '< 2'
7
7
  - gem uninstall -aIx nokogiri -i /home/travis/.rvm/gems/ruby-2.4.1@global nokogiri
8
8
 
9
9
  script: bash ./rake-script.sh
@@ -13,8 +13,10 @@ rvm:
13
13
  - 2.1.0
14
14
  - 2.1.1
15
15
  - 2.1.5
16
- - 2.2.0
17
- - 2.3.0
16
+ - 2.2.10
17
+ - 2.3.7
18
+ - 2.4.4
19
+ - 2.5.1
18
20
  - jruby-head
19
21
 
20
22
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.4.9
2
+
3
+ **Added**
4
+ - Current Ruby versions added in .travis.yml for testing
5
+ - Asynchronous deletion of Managed Disk added
6
+
7
+ **Changed**
8
+
9
+ - List method which handles pagination by default has been updated for Network Security Group.
10
+ - .travis.yml updated to handle bundler gem dependency on Ruby 2.3+
11
+ - Mocks for Azure::Blobs updated
12
+
1
13
  ## 0.4.8
2
14
 
3
15
  **Added:**
data/README.md CHANGED
@@ -80,7 +80,9 @@ Use following command for the complete list of services, Fog provides for Azure
80
80
  ```ruby
81
81
  Fog::AzureRM.services
82
82
  ```
83
+ # Documentation
83
84
 
85
+ https://www.rubydoc.info/github/fog/fog-azure-rm/master
84
86
 
85
87
  ## Contributing
86
88
 
@@ -388,6 +388,8 @@ Get an managed disk object from the get method and then destroy that managed dis
388
388
 
389
389
  ```ruby
390
390
  managed_disk.destroy
391
+ # Can be made asynchronously (is synchronous by default)
392
+ managed_disk.destroy(true)
391
393
  ```
392
394
 
393
395
  ## Check Availability Set Existence
@@ -46,8 +46,10 @@ module Fog
46
46
  merge_attributes(Fog::Compute::AzureRM::ManagedDisk.parse(disk))
47
47
  end
48
48
 
49
- def destroy
50
- service.delete_managed_disk(resource_group_name, name)
49
+ def destroy(async = false)
50
+ response = service.delete_managed_disk(resource_group_name, name,
51
+ async)
52
+ async ? create_fog_async_response(response) : response
51
53
  end
52
54
 
53
55
  private
@@ -71,6 +73,11 @@ module Fog
71
73
  encryption_settings: encryption_settings
72
74
  }
73
75
  end
76
+
77
+ def create_fog_async_response(response, delete_extra_resource = false)
78
+ disk = Fog::Compute::AzureRM::ManagedDisk.new(service: service)
79
+ Fog::AzureRM::AsyncResponse.new(disk, response, delete_extra_resource)
80
+ end
74
81
  end
75
82
  end
76
83
  end
@@ -4,16 +4,24 @@ module Fog
4
4
  class AzureRM
5
5
  # Real class for Compute Request
6
6
  class Real
7
- def delete_managed_disk(resource_group_name, disk_name)
7
+ def delete_managed_disk(resource_group_name, disk_name, async)
8
8
  msg = "Deleting Managed Disk: #{disk_name}"
9
9
  Fog::Logger.debug msg
10
10
  begin
11
- @compute_mgmt_client.disks.delete(resource_group_name, disk_name)
11
+ if async
12
+ response = @compute_mgmt_client.disks.delete_async(resource_group_name, disk_name)
13
+ else
14
+ @compute_mgmt_client.disks.delete(resource_group_name, disk_name)
15
+ end
12
16
  rescue MsRestAzure::AzureOperationError => e
13
17
  raise_azure_exception(e, msg)
14
18
  end
15
- Fog::Logger.debug "Managed Disk #{disk_name} deleted successfully."
16
- true
19
+ if async
20
+ response
21
+ else
22
+ Fog::Logger.debug "Managed Disk #{disk_name} deleted successfully."
23
+ true
24
+ end
17
25
  end
18
26
  end
19
27
 
@@ -8,160 +8,156 @@ module Fog
8
8
  Fog::Logger.debug msg
9
9
 
10
10
  begin
11
- nsg_list_result = @network_client.network_security_groups.list_as_lazy(resource_group)
11
+ nsg_list_result = @network_client.network_security_groups.list(resource_group)
12
12
  rescue MsRestAzure::AzureOperationError => e
13
13
  raise_azure_exception(e, msg)
14
14
  end
15
15
 
16
16
  Fog::Logger.debug "Network Security Groups list retrieved successfully from Resource Group #{resource_group}."
17
- nsg_list_result.value
17
+ nsg_list_result
18
18
  end
19
19
  end
20
20
 
21
21
  # Mock class for Network Request
22
22
  class Mock
23
23
  def list_network_security_groups(resource_group)
24
- nsg_list_result = {
25
- 'value' => [
26
- {
27
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup",
28
- 'name' => 'testGroup',
29
- 'type' => 'Microsoft.Network/networkSecurityGroups',
30
- 'location' => 'westus',
31
- 'properties' =>
32
- {
33
- 'securityRules' =>
34
- [
35
- {
36
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/securityRules/testRule",
37
- 'properties' =>
38
- {
39
- 'protocol' => 'tcp',
40
- 'sourceAddressPrefix' => '0.0.0.0/0',
41
- 'destinationAddressPrefix' => '0.0.0.0/0',
42
- 'access' => 'Allow',
43
- 'direction' => 'Inbound',
44
- 'sourcePortRange' => '22',
45
- 'destinationPortRange' => '22',
46
- 'priority' => 100,
47
- 'provisioningState' => 'Succeeded'
48
- },
49
- 'name' => 'testRule'
50
- }
51
- ],
52
- 'defaultSecurityRules' =>
53
- [
54
- {
55
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetInBound",
56
- 'properties' =>
57
- {
58
- 'protocol' => '*',
59
- 'sourceAddressPrefix' => 'VirtualNetwork',
60
- 'destinationAddressPrefix' => 'VirtualNetwork',
61
- 'access' => 'Allow',
62
- 'direction' => 'Inbound',
63
- 'description' => 'Allow inbound traffic from all VMs in VNET',
64
- 'sourcePortRange' => '*',
65
- 'destinationPortRange' => '*',
66
- 'priority' => 65_000,
67
- 'provisioningState' => 'Succeeded'
68
- },
69
- 'name' => 'AllowVnetInBound'
70
- },
71
- {
72
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowAzureLoadBalancerInBound",
73
- 'properties' =>
74
- {
75
- 'protocol' => '*',
76
- 'sourceAddressPrefix' => 'AzureLoadBalancer',
77
- 'destinationAddressPrefix' => '*',
78
- 'access' => 'Allow',
79
- 'direction' => 'Inbound',
80
- 'description' => 'Allow inbound traffic from azure load balancer',
81
- 'sourcePortRange' => '*',
82
- 'destinationPortRange' => '*',
83
- 'priority' => 65_001,
84
- 'provisioningState' => 'Succeeded'
85
- },
86
- 'name' => 'AllowAzureLoadBalancerInBound'
87
- },
88
- {
89
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllInBound",
90
- 'properties' =>
91
- {
92
- 'protocol' => '*',
93
- 'sourceAddressPrefix' => '*',
94
- 'destinationAddressPrefix' => '*',
95
- 'access' => 'Deny',
96
- 'direction' => 'Inbound',
97
- 'description' => 'Deny all inbound traffic',
98
- 'sourcePortRange' => '*',
99
- 'destinationPortRange' => '*',
100
- 'priority' => 65_500,
101
- 'provisioningState' => 'Succeeded'
102
- },
103
- 'name' => 'DenyAllInBound'
104
- },
105
- {
106
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetOutBound",
107
- 'properties' =>
108
- {
109
- 'protocol' => '*',
110
- 'sourceAddressPrefix' => 'VirtualNetwork',
111
- 'destinationAddressPrefix' => 'VirtualNetwork',
112
- 'access' => 'Allow',
113
- 'direction' => 'Outbound',
114
- 'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
115
- 'sourcePortRange' => '*',
116
- 'destinationPortRange' => '*',
117
- 'priority' => 65_000,
118
- 'provisioningState' => 'Succeeded'
119
- },
120
- 'name' => 'AllowVnetOutBound'
121
- },
122
- {
123
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowInternetOutBound",
124
- 'properties' =>
125
- {
126
- 'protocol' => '*',
127
- 'sourceAddressPrefix' => '*',
128
- 'destinationAddressPrefix' => 'Internet',
129
- 'access' => 'Allow',
130
- 'direction' => 'Outbound',
131
- 'description' => 'Allow outbound traffic from all VMs to Internet',
132
- 'sourcePortRange' => '*',
133
- 'destinationPortRange' => '*',
134
- 'priority' => 65_001,
135
- 'provisioningState' => 'Succeeded'
136
- },
137
- 'name' => 'AllowInternetOutBound'
138
- },
139
- {
140
- 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllOutBound",
141
- 'properties' =>
142
- {
143
- 'protocol' => '*',
144
- 'sourceAddressPrefix' => '*',
145
- 'destinationAddressPrefix' => '*',
146
- 'access' => 'Deny',
147
- 'direction' => 'Outbound',
148
- 'description' => 'Deny all outbound traffic',
149
- 'sourcePortRange' => '*',
150
- 'destinationPortRange' => '*',
151
- 'priority' => 65_500,
152
- 'provisioningState' => 'Succeeded'
153
- },
154
- 'name' => 'DenyAllOutBound'
155
- }
156
- ],
157
- 'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
158
- 'provisioningState' => 'Succeeded'
159
- }
160
- }
161
- ]
162
- }
163
- nsg_mapper = Azure::ARM::Network::Models::NetworkInterfaceListResult.mapper
164
- @network_client.deserialize(nsg_mapper, nsg_list_result, 'result.body').value
24
+ [
25
+ {
26
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup",
27
+ 'name' => 'testGroup',
28
+ 'type' => 'Microsoft.Network/networkSecurityGroups',
29
+ 'location' => 'westus',
30
+ 'properties' =>
31
+ {
32
+ 'securityRules' =>
33
+ [
34
+ {
35
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/securityRules/testRule",
36
+ 'properties' =>
37
+ {
38
+ 'protocol' => 'tcp',
39
+ 'sourceAddressPrefix' => '0.0.0.0/0',
40
+ 'destinationAddressPrefix' => '0.0.0.0/0',
41
+ 'access' => 'Allow',
42
+ 'direction' => 'Inbound',
43
+ 'sourcePortRange' => '22',
44
+ 'destinationPortRange' => '22',
45
+ 'priority' => 100,
46
+ 'provisioningState' => 'Succeeded'
47
+ },
48
+ 'name' => 'testRule'
49
+ }
50
+ ],
51
+ 'defaultSecurityRules' =>
52
+ [
53
+ {
54
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetInBound",
55
+ 'properties' =>
56
+ {
57
+ 'protocol' => '*',
58
+ 'sourceAddressPrefix' => 'VirtualNetwork',
59
+ 'destinationAddressPrefix' => 'VirtualNetwork',
60
+ 'access' => 'Allow',
61
+ 'direction' => 'Inbound',
62
+ 'description' => 'Allow inbound traffic from all VMs in VNET',
63
+ 'sourcePortRange' => '*',
64
+ 'destinationPortRange' => '*',
65
+ 'priority' => 65_000,
66
+ 'provisioningState' => 'Succeeded'
67
+ },
68
+ 'name' => 'AllowVnetInBound'
69
+ },
70
+ {
71
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowAzureLoadBalancerInBound",
72
+ 'properties' =>
73
+ {
74
+ 'protocol' => '*',
75
+ 'sourceAddressPrefix' => 'AzureLoadBalancer',
76
+ 'destinationAddressPrefix' => '*',
77
+ 'access' => 'Allow',
78
+ 'direction' => 'Inbound',
79
+ 'description' => 'Allow inbound traffic from azure load balancer',
80
+ 'sourcePortRange' => '*',
81
+ 'destinationPortRange' => '*',
82
+ 'priority' => 65_001,
83
+ 'provisioningState' => 'Succeeded'
84
+ },
85
+ 'name' => 'AllowAzureLoadBalancerInBound'
86
+ },
87
+ {
88
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllInBound",
89
+ 'properties' =>
90
+ {
91
+ 'protocol' => '*',
92
+ 'sourceAddressPrefix' => '*',
93
+ 'destinationAddressPrefix' => '*',
94
+ 'access' => 'Deny',
95
+ 'direction' => 'Inbound',
96
+ 'description' => 'Deny all inbound traffic',
97
+ 'sourcePortRange' => '*',
98
+ 'destinationPortRange' => '*',
99
+ 'priority' => 65_500,
100
+ 'provisioningState' => 'Succeeded'
101
+ },
102
+ 'name' => 'DenyAllInBound'
103
+ },
104
+ {
105
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowVnetOutBound",
106
+ 'properties' =>
107
+ {
108
+ 'protocol' => '*',
109
+ 'sourceAddressPrefix' => 'VirtualNetwork',
110
+ 'destinationAddressPrefix' => 'VirtualNetwork',
111
+ 'access' => 'Allow',
112
+ 'direction' => 'Outbound',
113
+ 'description' => 'Allow outbound traffic from all VMs to all VMs in VNET',
114
+ 'sourcePortRange' => '*',
115
+ 'destinationPortRange' => '*',
116
+ 'priority' => 65_000,
117
+ 'provisioningState' => 'Succeeded'
118
+ },
119
+ 'name' => 'AllowVnetOutBound'
120
+ },
121
+ {
122
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/AllowInternetOutBound",
123
+ 'properties' =>
124
+ {
125
+ 'protocol' => '*',
126
+ 'sourceAddressPrefix' => '*',
127
+ 'destinationAddressPrefix' => 'Internet',
128
+ 'access' => 'Allow',
129
+ 'direction' => 'Outbound',
130
+ 'description' => 'Allow outbound traffic from all VMs to Internet',
131
+ 'sourcePortRange' => '*',
132
+ 'destinationPortRange' => '*',
133
+ 'priority' => 65_001,
134
+ 'provisioningState' => 'Succeeded'
135
+ },
136
+ 'name' => 'AllowInternetOutBound'
137
+ },
138
+ {
139
+ 'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/networkSecurityGroups/testGroup/defaultSecurityRules/DenyAllOutBound",
140
+ 'properties' =>
141
+ {
142
+ 'protocol' => '*',
143
+ 'sourceAddressPrefix' => '*',
144
+ 'destinationAddressPrefix' => '*',
145
+ 'access' => 'Deny',
146
+ 'direction' => 'Outbound',
147
+ 'description' => 'Deny all outbound traffic',
148
+ 'sourcePortRange' => '*',
149
+ 'destinationPortRange' => '*',
150
+ 'priority' => 65_500,
151
+ 'provisioningState' => 'Succeeded'
152
+ },
153
+ 'name' => 'DenyAllOutBound'
154
+ }
155
+ ],
156
+ 'resourceGuid' => '9dca97e6-4789-4ebd-86e3-52b8b0da6cd4',
157
+ 'provisioningState' => 'Succeeded'
158
+ }
159
+ }
160
+ ]
165
161
  end
166
162
  end
167
163
  end
@@ -21,33 +21,33 @@ module Fog
21
21
  # This class provides the mock implementation for unit tests.
22
22
  class Mock
23
23
  def get_blob_properties(*)
24
- {
25
- 'name' => 'test_blob',
26
- 'metadata' => {},
27
- 'properties' => {
28
- 'last_modified' => 'Mon, 04 Jul 2016 09:30:31 GMT',
29
- 'etag' => '0x8D3A3EDD7C2B777',
30
- 'lease_status' => 'unlocked',
31
- 'lease_state' => 'available',
32
- 'lease_duration' => nil,
33
- 'content_length' => 4_194_304,
34
- 'content_type' => 'application/octet-stream',
35
- 'content_encoding' => nil,
36
- 'content_language' => nil,
37
- 'content_disposition' => nil,
38
- 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
39
- 'cache_control' => nil,
40
- 'sequence_number' => 0,
41
- 'blob_type' => 'PageBlob',
42
- 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
43
- 'copy_status' => 'success',
44
- 'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
45
- 'copy_progress' => '4194304/4194304',
46
- 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
47
- 'copy_status_description' => nil,
48
- 'accept_ranges' => 0
49
- }
24
+ blob = Azure::Storage::Blob::Blob.new
25
+ blob.name = 'test_blob'
26
+ blob.metadata = {}
27
+ blob.properties = {
28
+ last_modified: 'Mon, 04 Jul 2016 09:30:31 GMT',
29
+ etag: '0x8D3A3EDD7C2B777',
30
+ lease_status: 'unlocked',
31
+ lease_state: 'available',
32
+ lease_duration: nil,
33
+ content_length: 4_194_304,
34
+ content_type: 'application/octet-stream',
35
+ content_encoding: nil,
36
+ content_language: nil,
37
+ content_disposition: nil,
38
+ content_md5: 'tXAohIyxuu/t94Lp/ujeRw==',
39
+ cache_control: nil,
40
+ sequence_number: 0,
41
+ blob_type: 'PageBlob',
42
+ copy_id: '095adc3b-e277-4c3d-97e0-0abca881f60c',
43
+ copy_status: 'success',
44
+ copy_source: 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
45
+ copy_progress: '4194304/4194304',
46
+ copy_completion_time: 'Thu, 04 Feb 2016 08:35:52 GMT',
47
+ copy_status_description: nil,
48
+ accept_ranges: 0
50
49
  }
50
+ blob
51
51
  end
52
52
  end
53
53
  end
@@ -77,6 +77,7 @@ module Fog
77
77
  def initialize(_options = {})
78
78
  begin
79
79
  require 'azure_mgmt_storage'
80
+ require 'azure/storage'
80
81
  rescue LoadError => e
81
82
  retry if require('rubygems')
82
83
  raise e.message
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '0.4.8'.freeze
3
+ VERSION = '0.4.9'.freeze
4
4
  end
5
5
  end
@@ -216,8 +216,8 @@ module ApiStub
216
216
  }
217
217
  ]
218
218
  }'
219
- result_mapper = Azure::ARM::Network::Models::NetworkInterfaceListResult.mapper
220
- network_client.deserialize(result_mapper, Fog::JSON.decode(nsg_list), 'result.body')
219
+ result_mapper = Azure::ARM::Network::Models::NetworkSecurityGroupListResult.mapper
220
+ network_client.deserialize(result_mapper, Fog::JSON.decode(nsg_list), 'result.body').value
221
221
  end
222
222
  end
223
223
  end
@@ -5,6 +5,15 @@ module ApiStub
5
5
  # Below data should be as same as those in Mock classes in lib/fog/azurerm/requests/storage/*.rb
6
6
  class File
7
7
  def self.blob
8
+ blob_data = blob_as_hash
9
+ blob = Azure::Storage::Blob::Blob.new
10
+ blob.name = blob_data['name']
11
+ blob.metadata = blob_data['metadata']
12
+ blob.properties = blob_data['properties'].map { |k, v| { k.to_sym => v } }.reduce({}, &:merge!)
13
+ blob
14
+ end
15
+
16
+ def self.blob_as_hash
8
17
  {
9
18
  'name' => 'test_blob',
10
19
  'metadata' => {},
@@ -50,13 +50,20 @@ class TestManagedDisk < Minitest::Test
50
50
 
51
51
  def test_destroy_method_true_response
52
52
  @service.stub :delete_managed_disk, true do
53
- assert @managed_disk.destroy
53
+ assert @managed_disk.destroy(false)
54
54
  end
55
55
  end
56
56
 
57
57
  def test_destroy_method_false_response
58
58
  @service.stub :delete_managed_disk, false do
59
- assert !@managed_disk.destroy
59
+ assert !@managed_disk.destroy(false)
60
+ end
61
+ end
62
+
63
+ def test_destroy_method_can_take_params_async
64
+ async_response = Concurrent::Promise.execute { 10 }
65
+ @service.stub :delete_managed_disk, async_response do
66
+ assert_instance_of Fog::AzureRM::AsyncResponse, @managed_disk.destroy(true)
60
67
  end
61
68
  end
62
69
  end
@@ -10,14 +10,14 @@ class TestDeleteManagedDisk < Minitest::Test
10
10
 
11
11
  def test_delete_managed_disk_success
12
12
  @managed_disks.stub :delete, true do
13
- assert @service.delete_managed_disk('fog-test-rg', 'test-disk')
13
+ assert @service.delete_managed_disk('fog-test-rg', 'test-disk', false)
14
14
  end
15
15
  end
16
16
 
17
17
  def test_delete_managed_disk_failure
18
18
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
19
  @managed_disks.stub :delete, response do
20
- assert_raises(MsRestAzure::AzureOperationError) { @service.delete_managed_disk('fog-test-rg', 'test-disk') }
20
+ assert_raises(MsRestAzure::AzureOperationError) { @service.delete_managed_disk('fog-test-rg', 'test-disk', false) }
21
21
  end
22
22
  end
23
23
  end
@@ -10,14 +10,14 @@ class TestListNetworkSecurityGroup < Minitest::Test
10
10
 
11
11
  def test_list_network_security_group_success
12
12
  mocked_response = ApiStub::Requests::Network::NetworkSecurityGroup.list_network_security_group_response(@client)
13
- @network_security_groups.stub :list_as_lazy, mocked_response do
14
- assert_equal @service.list_network_security_groups('fog-test-rg'), mocked_response.value
13
+ @network_security_groups.stub :list, mocked_response do
14
+ assert_equal @service.list_network_security_groups('fog-test-rg'), mocked_response
15
15
  end
16
16
  end
17
17
 
18
18
  def test_list_network_security_group_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
- @network_security_groups.stub :list_as_lazy, response do
20
+ @network_security_groups.stub :list, response do
21
21
  assert_raises MsRestAzure::AzureOperationError do
22
22
  @service.list_network_security_groups('fog-test-rg')
23
23
  end
@@ -13,7 +13,7 @@ class TestGetBlob < Minitest::Test
13
13
  @blob_client = @service.instance_variable_get(:@blob_client)
14
14
 
15
15
  @raw_cloud_blob = storage_blob
16
- @blob = ApiStub::Requests::Storage::File.blob
16
+ @blob = ApiStub::Requests::Storage::File.blob_as_hash
17
17
  @blob_with_content = [
18
18
  @blob,
19
19
  'content'
@@ -40,6 +40,8 @@ class TestGetBlobProperties < Minitest::Test
40
40
  end
41
41
 
42
42
  def test_get_blob_properties_mock
43
- assert_equal @blob, @mock_service.get_blob_properties('test_container', 'test_blob')
43
+ mock_blob_properties = @mock_service.get_blob_properties('test_container', 'test_blob')
44
+ assert_equal @blob.name, mock_blob_properties.name
45
+ assert_equal @blob.properties, mock_blob_properties.properties
44
46
  end
45
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-azure-rm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaffan Chaudhry
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2018-05-24 00:00:00.000000000 Z
21
+ date: 2019-01-18 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: rake
@@ -1059,8 +1059,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1059
1059
  - !ruby/object:Gem::Version
1060
1060
  version: '0'
1061
1061
  requirements: []
1062
- rubyforge_project:
1063
- rubygems_version: 2.7.7
1062
+ rubygems_version: 3.0.2
1064
1063
  signing_key:
1065
1064
  specification_version: 4
1066
1065
  summary: Module for the 'fog' gem to support Azure Resource Manager cloud services.