fog-azure-rm 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/lib/fog/azurerm/compute.rb +6 -0
  4. data/lib/fog/azurerm/docs/compute.md +67 -11
  5. data/lib/fog/azurerm/docs/network.md +59 -0
  6. data/lib/fog/azurerm/docs/storage.md +107 -35
  7. data/lib/fog/azurerm/models/compute/server.rb +15 -9
  8. data/lib/fog/azurerm/models/compute/virtual_machine_extension.rb +78 -0
  9. data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +30 -0
  10. data/lib/fog/azurerm/models/network/express_route_circuit.rb +21 -21
  11. data/lib/fog/azurerm/models/network/express_route_circuit_peering.rb +21 -21
  12. data/lib/fog/azurerm/models/network/express_route_service_provider.rb +8 -8
  13. data/lib/fog/azurerm/models/network/network_security_rule.rb +27 -0
  14. data/lib/fog/azurerm/models/network/network_security_rules.rb +31 -0
  15. data/lib/fog/azurerm/models/network/subnet.rb +16 -12
  16. data/lib/fog/azurerm/models/network/virtual_network_gateway.rb +6 -6
  17. data/lib/fog/azurerm/models/storage/{containers.rb → directories.rb} +10 -10
  18. data/lib/fog/azurerm/models/storage/{container.rb → directory.rb} +13 -13
  19. data/lib/fog/azurerm/models/storage/file.rb +151 -0
  20. data/lib/fog/azurerm/models/storage/files.rb +31 -0
  21. data/lib/fog/azurerm/network.rb +6 -0
  22. data/lib/fog/azurerm/requests/compute/create_or_update_vm_extension.rb +63 -0
  23. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +45 -8
  24. data/lib/fog/azurerm/requests/compute/delete_vm_extension.rb +28 -0
  25. data/lib/fog/azurerm/requests/compute/get_vm_extension.rb +46 -0
  26. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +44 -31
  27. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_peering.rb +23 -13
  28. data/lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb +59 -0
  29. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway.rb +23 -15
  30. data/lib/fog/azurerm/requests/network/delete_network_security_rule.rb +30 -0
  31. data/lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb +23 -0
  32. data/lib/fog/azurerm/requests/network/get_network_security_rule.rb +47 -0
  33. data/lib/fog/azurerm/requests/network/list_network_security_groups.rb +1 -1
  34. data/lib/fog/azurerm/requests/network/list_network_security_rules.rb +51 -0
  35. data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +29 -0
  36. data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +29 -0
  37. data/lib/fog/azurerm/requests/storage/check_blob_exist.rb +25 -0
  38. data/lib/fog/azurerm/requests/storage/compare_blob.rb +73 -0
  39. data/lib/fog/azurerm/requests/storage/copy_blob.rb +30 -0
  40. data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +30 -0
  41. data/lib/fog/azurerm/requests/storage/delete_blob.rb +27 -0
  42. data/lib/fog/azurerm/requests/storage/download_blob_to_file.rb +56 -0
  43. data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +37 -9
  44. data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +53 -0
  45. data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +2 -2
  46. data/lib/fog/azurerm/requests/storage/list_blobs.rb +82 -0
  47. data/lib/fog/azurerm/requests/storage/list_containers.rb +1 -1
  48. data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +27 -0
  49. data/lib/fog/azurerm/requests/storage/release_container_lease.rb +27 -0
  50. data/lib/fog/azurerm/requests/storage/set_blob_metadata.rb +4 -4
  51. data/lib/fog/azurerm/requests/storage/set_blob_properties.rb +26 -0
  52. data/lib/fog/azurerm/requests/storage/set_container_metadata.rb +3 -3
  53. data/lib/fog/azurerm/requests/storage/upload_block_blob_from_file.rb +60 -0
  54. data/lib/fog/azurerm/storage.rb +26 -8
  55. data/lib/fog/azurerm/utilities/general.rb +14 -1
  56. data/lib/fog/azurerm/version.rb +1 -1
  57. data/test/api_stub.rb +8 -4
  58. data/test/api_stub/models/compute/virtual_machine_extension.rb +31 -0
  59. data/test/api_stub/models/network/network_security_rule.rb +30 -0
  60. data/test/api_stub/models/storage/{container.rb → directory.rb} +1 -1
  61. data/test/api_stub/models/storage/file.rb +178 -0
  62. data/test/api_stub/requests/compute/virtual_machine.rb +119 -0
  63. data/test/api_stub/requests/compute/virtual_machine_extension.rb +46 -0
  64. data/test/api_stub/requests/network/network_security_rule.rb +72 -0
  65. data/test/api_stub/requests/storage/{container.rb → directory.rb} +2 -2
  66. data/test/api_stub/requests/storage/file.rb +164 -0
  67. data/test/integration/availability_set.rb +6 -0
  68. data/test/integration/blob.rb +205 -0
  69. data/test/integration/credentials/azure.yml +4 -4
  70. data/test/integration/deployment.rb +9 -0
  71. data/test/integration/external_load_balancer.rb +9 -0
  72. data/test/integration/internal_load_balancer.rb +8 -0
  73. data/test/integration/network_security_group.rb +9 -0
  74. data/test/integration/network_security_rule.rb +86 -0
  75. data/test/integration/server.rb +62 -9
  76. data/test/integration/server_custom_image.rb +118 -0
  77. data/test/integration/subnet.rb +12 -1
  78. data/test/integration/virtual_machine_extension.rb +148 -0
  79. data/test/integration/virtual_network.rb +9 -1
  80. data/test/integration/virtual_network_gateway.rb +7 -29
  81. data/test/integration/virtual_network_gateway_connection_to_express_route.rb +116 -0
  82. data/test/models/compute/test_virtual_machine_extension.rb +61 -0
  83. data/test/models/compute/test_virtual_machine_extensions.rb +36 -0
  84. data/test/models/network/test_express_route_circuit.rb +4 -10
  85. data/test/models/network/test_express_route_circuit_peering.rb +4 -10
  86. data/test/models/network/test_network_interface.rb +4 -8
  87. data/test/models/network/test_network_security_rule.rb +14 -0
  88. data/test/models/network/test_network_security_rules.rb +42 -0
  89. data/test/models/network/test_subnet.rb +5 -0
  90. data/test/models/storage/test_directories.rb +106 -0
  91. data/test/models/storage/test_directory.rb +125 -0
  92. data/test/models/storage/test_file.rb +258 -0
  93. data/test/models/storage/test_files.rb +67 -0
  94. data/test/models/storage/test_storage_account.rb +2 -4
  95. data/test/requests/compute/test_create_virtual_machine.rb +19 -5
  96. data/test/requests/compute/test_create_vm_extension.rb +35 -0
  97. data/test/requests/compute/test_get_vm_extension.rb +26 -0
  98. data/test/requests/compute/test_update_vm_extension.rb +35 -0
  99. data/test/requests/network/test_create_or_update_network_security_rule.rb +28 -0
  100. data/test/requests/network/test_delete_network_security_rule.rb +25 -0
  101. data/test/requests/network/test_get_available_ipaddresses_count.rb +18 -0
  102. data/test/requests/network/test_get_network_security_rule.rb +26 -0
  103. data/test/requests/network/test_list_network_security_groups.rb +2 -2
  104. data/test/requests/network/test_list_network_security_rules.rb +26 -0
  105. data/test/requests/storage/test_acquire_blob_lease.rb +17 -0
  106. data/test/requests/storage/test_acquire_container_lease.rb +17 -0
  107. data/test/requests/storage/test_check_blob_exist.rb +17 -0
  108. data/test/requests/storage/test_compare_blob.rb +17 -0
  109. data/test/requests/storage/test_copy_blob.rb +17 -0
  110. data/test/requests/storage/test_copy_blob_from_uri.rb +17 -0
  111. data/test/requests/storage/test_create_container.rb +2 -2
  112. data/test/requests/storage/test_delete_blob.rb +22 -0
  113. data/test/requests/storage/test_delete_container.rb +1 -1
  114. data/test/requests/storage/test_download_blob_to_file.rb +25 -0
  115. data/test/requests/storage/test_get_blob_metadata.rb +2 -2
  116. data/test/requests/storage/test_get_blob_properties.rb +23 -0
  117. data/test/requests/storage/test_get_container_access_control_list.rb +2 -2
  118. data/test/requests/storage/test_get_container_metadata.rb +2 -2
  119. data/test/requests/storage/test_get_container_properties.rb +2 -2
  120. data/test/requests/storage/test_list_blobs_in_container.rb +23 -0
  121. data/test/requests/storage/test_list_containers.rb +2 -2
  122. data/test/requests/storage/test_release_blob_lease.rb +16 -0
  123. data/test/requests/storage/test_release_container_lease.rb +16 -0
  124. data/test/requests/storage/test_set_blob_metadata.rb +1 -1
  125. data/test/requests/storage/test_set_blob_properties.rb +16 -0
  126. data/test/requests/storage/test_set_container_metadata.rb +1 -1
  127. data/test/requests/storage/test_upload_block_blob_from_file.rb +23 -0
  128. data/test/test_helper.rb +116 -3
  129. metadata +73 -15
  130. data/.DS_Store +0 -0
  131. data/lib/fog/azurerm/fog_azure_rm_exception.rb +0 -13
  132. data/lib/fog/azurerm/models/storage/blob.rb +0 -13
  133. data/lib/fog/azurerm/models/storage/blobs.rb +0 -22
  134. data/test/api_stub/models/storage/blob.rb +0 -17
  135. data/test/api_stub/requests/storage/blob.rb +0 -24
  136. data/test/models/storage/test_blobs.rb +0 -32
  137. data/test/models/storage/test_container.rb +0 -67
  138. data/test/models/storage/test_containers.rb +0 -56
@@ -0,0 +1,35 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Update VM Extension request
4
+ class TestUpdateVMExtension < Minitest::Test
5
+ def setup
6
+ @service = Fog::Compute::AzureRM.new(credentials)
7
+ compute_client = @service.instance_variable_get(:@compute_mgmt_client)
8
+ @vm_extension = compute_client.virtual_machine_extensions
9
+ @response = ApiStub::Requests::Compute::VirtualMachineExtension.create_vm_extension_response(compute_client)
10
+ @vm_extension_hash = ApiStub::Requests::Compute::VirtualMachineExtension.vm_extension_params
11
+ end
12
+
13
+ def test_update_vm_extension_success
14
+ @vm_extension.stub :create_or_update, @response do
15
+ assert_equal @service.create_or_update_vm_extension(@vm_extension_hash), @response
16
+ end
17
+ end
18
+
19
+ def test_update_vm_extension_argument_error
20
+ @vm_extension.stub :create_or_update, @response do
21
+ assert_raises ArgumentError do
22
+ @service.create_or_update_vm_extension
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_update_vm_extension_failure
28
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
29
+ @vm_extension.stub :create_or_update, response do
30
+ assert_raises RuntimeError do
31
+ @service.create_or_update_vm_extension(@vm_extension_hash)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Create Network Security Rule
4
+ class TestCreateOrUpdateNetworkSecurityRule < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @client = @service.instance_variable_get(:@network_client)
8
+ @network_security_rules = @client.security_rules
9
+ end
10
+
11
+ def test_create_or_update_network_security_rule_success
12
+ mocked_response = ApiStub::Requests::Network::NetworkSecurityRule.create_network_security_rule_response(@client)
13
+ security_rule_params = ApiStub::Requests::Network::NetworkSecurityRule.network_security_rule_paramteres_hash
14
+ @network_security_rules.stub :create_or_update, mocked_response do
15
+ assert_equal @service.create_or_update_network_security_rule(security_rule_params), mocked_response
16
+ end
17
+ end
18
+
19
+ def test_create_or_update_network_security_rule_failure
20
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
+ security_rule_params = ApiStub::Requests::Network::NetworkSecurityRule.network_security_rule_paramteres_hash
22
+ @network_security_rules.stub :create_or_update, response do
23
+ assert_raises RuntimeError do
24
+ @service.create_or_update_network_security_rule(security_rule_params)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Delete Network Security Rule
4
+ class TestDeleteNetworkSecurityRule < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ client = @service.instance_variable_get(:@network_client)
8
+ @network_security_rules = client.security_rules
9
+ end
10
+
11
+ def test_delete_network_security_rule_success
12
+ @network_security_rules.stub :delete, true do
13
+ assert_equal @service.delete_network_security_rule('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr'), true
14
+ end
15
+ end
16
+
17
+ def test_delete_network_security_rule_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @network_security_rules.stub :delete, response do
20
+ assert_raises RuntimeError do
21
+ @service.delete_network_security_rule('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Available IP Address Count
4
+ class TestGetAvailableIPAddressesCount < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ end
8
+
9
+ def test_get_available_ipaddresses_count_success
10
+ assert_equal @service.get_available_ipaddresses_count('fog-test-subnet', '10.0.0.0/24', [], false), 254
11
+ end
12
+
13
+ def test_get_available_ipaddresses_count_argument_error
14
+ assert_raises ArgumentError do
15
+ @service.get_available_ipaddresses_count('fog-test-subnet', '10.0.0.0/24')
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Network Security Rule
4
+ class TestGetNetworkSecurityRule < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @client = @service.instance_variable_get(:@network_client)
8
+ @network_security_rules = @client.security_rules
9
+ end
10
+
11
+ def test_get_network_security_rule_success
12
+ mocked_response = ApiStub::Requests::Network::NetworkSecurityRule.create_network_security_rule_response(@client)
13
+ @network_security_rules.stub :get, mocked_response do
14
+ assert_equal @service.get_network_security_rule('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_network_security_rule_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @network_security_rules.stub :get, response do
21
+ assert_raises RuntimeError do
22
+ @service.get_network_security_rule('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
23
+ end
24
+ end
25
+ end
26
+ 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, mocked_response do
13
+ @network_security_groups.stub :list_as_lazy, mocked_response do
14
14
  assert_equal @service.list_network_security_groups('fog-test-rg'), mocked_response.value
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, response do
20
+ @network_security_groups.stub :list_as_lazy, response do
21
21
  assert_raises RuntimeError do
22
22
  @service.list_network_security_groups('fog-test-rg')
23
23
  end
@@ -0,0 +1,26 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for List Network Security Rule
4
+ class TestListNetworkSecurityRule < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @client = @service.instance_variable_get(:@network_client)
8
+ @network_security_rules = @client.security_rules
9
+ end
10
+
11
+ def test_list_network_security_rule_success
12
+ mocked_response = ApiStub::Requests::Network::NetworkSecurityRule.list_network_security_rules(@client)
13
+ @network_security_rules.stub :list_as_lazy, mocked_response do
14
+ assert_equal @service.list_network_security_rules('fog-test-rg', 'fog-test-nsg'), mocked_response.value
15
+ end
16
+ end
17
+
18
+ def test_list_network_security_rule_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @network_security_rules.stub :list_as_lazy, response do
21
+ assert_raises RuntimeError do
22
+ @service.list_network_security_rules('fog-test-rg', 'fog-test-nsg')
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestListBlobs < Minitest::Test
5
+ # This class posesses the test cases for the requests of acquire blob lease.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ end
10
+
11
+ def test_acquire_blob_lease_success
12
+ lease_id = { 'leaseId' => 'abc123' }
13
+ @blob_client.stub :acquire_blob_lease, lease_id do
14
+ assert @service.acquire_blob_lease('test_container', 'test_blob'), lease_id
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestListBlobs < Minitest::Test
5
+ # This class posesses the test cases for the requests of acquire container lease.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ end
10
+
11
+ def test_acquire_container_lease_success
12
+ lease_id = { 'leaseId' => 'abc123' }
13
+ @blob_client.stub :acquire_container_lease, lease_id do
14
+ assert @service.acquire_container_lease('test_container'), lease_id
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestListBlobs < Minitest::Test
5
+ # This class posesses the test cases for the requests of checking if blob exists.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ end
10
+
11
+ def test_check_blob_exist_success
12
+ blob = ApiStub::Requests::Storage::File.get_blob_properties
13
+ @blob_client.stub :get_blob_properties, blob do
14
+ assert @service.check_blob_exist('test_container', 'test_blob'), true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestCompareBlobs < Minitest::Test
5
+ # This class posesses the test cases for the requests of comparing blobs.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @compare_blob_response = ApiStub::Requests::Storage::File.list_blobs_response
10
+ end
11
+
12
+ def test_compare_blobs_success
13
+ @service.stub :get_identical_blobs_from_containers, @compare_blob_response do
14
+ assert @service.compare_blob('container1', 'container2'), @compare_blob_response
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestCopyBlob < Minitest::Test
5
+ # This class posesses the test cases for the requests of copying blobs.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @copy_blob_reponse = ApiStub::Requests::Storage::File.copy_blob
10
+ end
11
+
12
+ def test_copy_blob_success
13
+ @blob_client.stub :copy_blob, @copy_blob_reponse do
14
+ assert @service.copy_blob('destination_container', 'destination_blob', 'source_container', 'source_blob'), @copy_blob_reponse
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestCopyBlobFromUri < Minitest::Test
5
+ # This class posesses the test cases for the requests of copying blobs.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @copy_blob_reponse = ApiStub::Requests::Storage::File.copy_blob
10
+ end
11
+
12
+ def test_copy_blob_from_uri_success
13
+ @blob_client.stub :copy_blob_from_uri, @copy_blob_reponse do
14
+ assert @service.copy_blob_from_uri('destination_container', 'destination_blob', 'VHD uri'), @copy_blob_reponse
15
+ end
16
+ end
17
+ end
@@ -1,12 +1,12 @@
1
1
  require File.expand_path '../../test_helper', __dir__
2
2
 
3
3
  # Storage Container Class
4
- class TestCreateContaienr < Minitest::Test
4
+ class TestCreateContainer < Minitest::Test
5
5
  # This class posesses the test cases for the requests of creating storage containers.
6
6
  def setup
7
7
  @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
8
  @blob_client = @service.instance_variable_get(:@blob_client)
9
- @storage_container_object = ApiStub::Requests::Storage::Container.create_container
9
+ @storage_container_object = ApiStub::Requests::Storage::Directory.create_container
10
10
  end
11
11
 
12
12
  def test_create_container_with_service_success
@@ -0,0 +1,22 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestDeleteBlob < Minitest::Test
5
+ # This class posesses the test cases for the requests of deleting storage blobs.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ end
10
+
11
+ def test_delete_blob_with_service_success
12
+ @blob_client.stub :delete_blob, true do
13
+ assert @service.delete_blob('testcontainer1', 'testblob1')
14
+ end
15
+ end
16
+
17
+ def test_delete_blob_with_internal_client_success
18
+ @blob_client.stub :delete_blob, true do
19
+ assert @blob_client.delete_blob('testcontainer1', 'testblob1')
20
+ end
21
+ end
22
+ end
@@ -1,7 +1,7 @@
1
1
  require File.expand_path '../../test_helper', __dir__
2
2
 
3
3
  # Storage Container Class
4
- class TestDeleteContaienr < Minitest::Test
4
+ class TestDeleteContainer < Minitest::Test
5
5
  # This class posesses the test cases for the requests of deleting storage containers.
6
6
  def setup
7
7
  @service = Fog::Storage::AzureRM.new(storage_account_credentials)
@@ -0,0 +1,25 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestDownloadBlob < Minitest::Test
5
+ # This class posesses the test cases for the requests of getting storage blob properties.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @storage_blob_object = ApiStub::Requests::Storage::File.download_blob_to_file
10
+ end
11
+
12
+ def test_download_blob_with_service_success
13
+ @blob_client.stub :get_blob, @storage_blob_object do
14
+ file_path = 'test.dat'
15
+ assert @service.download_blob_to_file('testcontainer', 'testblob1', file_path)
16
+ File.delete file_path
17
+ end
18
+ end
19
+
20
+ def test_download_blob_with_internal_client_success
21
+ @blob_client.stub :get_blob, @storage_blob_object do
22
+ assert @blob_client.get_blob('testcontainer', 'testblob1')
23
+ end
24
+ end
25
+ end
@@ -6,11 +6,11 @@ class TestGetBlobMetadata < Minitest::Test
6
6
  def setup
7
7
  @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
8
  @blob_client = @service.instance_variable_get(:@blob_client)
9
- @blob_object = ApiStub::Requests::Storage::Blob.test_get_blob_metadata
9
+ @blob_object = ApiStub::Requests::Storage::File.test_get_blob_metadata
10
10
  end
11
11
 
12
12
  def test_get_blob_metadata_success
13
- metadata_response = ApiStub::Requests::Storage::Blob.metadata_response
13
+ metadata_response = ApiStub::Requests::Storage::File.metadata_response
14
14
  @blob_client.stub :get_blob_metadata, @blob_object do
15
15
  assert_equal @service.get_blob_metadata('Test-container', 'Test-blob'), metadata_response
16
16
  end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestGetBlobProperties < Minitest::Test
5
+ # This class posesses the test cases for the requests of getting storage blob properties.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
+ @blob_client = @service.instance_variable_get(:@blob_client)
9
+ @storage_blob_object = ApiStub::Requests::Storage::File.get_blob_properties
10
+ end
11
+
12
+ def test_get_blob_properties_with_service_success
13
+ @blob_client.stub :get_blob_properties, @storage_blob_object do
14
+ assert @service.get_blob_properties('testcontainer', 'testblob1')
15
+ end
16
+ end
17
+
18
+ def test_get_blob_properties_with_internal_client_success
19
+ @blob_client.stub :get_blob_properties, @storage_blob_object do
20
+ assert @blob_client.get_blob_properties('testcontainer', 'testblob1')
21
+ end
22
+ end
23
+ end
@@ -1,12 +1,12 @@
1
1
  require File.expand_path '../../test_helper', __dir__
2
2
 
3
3
  # Storage Container Class
4
- class TestGetContaienrACL < Minitest::Test
4
+ class TestGetContainerACL < Minitest::Test
5
5
  # This class posesses the test cases for the requests of getting storage container properties.
6
6
  def setup
7
7
  @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
8
  @blob_client = @service.instance_variable_get(:@blob_client)
9
- @storage_container_object = ApiStub::Requests::Storage::Container.get_container_access_control_list
9
+ @storage_container_object = ApiStub::Requests::Storage::Directory.get_container_access_control_list
10
10
  end
11
11
 
12
12
  def test_get_container_acl_with_service_success
@@ -6,11 +6,11 @@ class TestGetContainerMetadata < Minitest::Test
6
6
  def setup
7
7
  @service = Fog::Storage::AzureRM.new(storage_account_credentials)
8
8
  @blob_client = @service.instance_variable_get(:@blob_client)
9
- @container_object = ApiStub::Requests::Storage::Container.test_get_container_metadata
9
+ @container_object = ApiStub::Requests::Storage::Directory.test_get_container_metadata
10
10
  end
11
11
 
12
12
  def test_get_container_metadata_success
13
- metadata_response = ApiStub::Requests::Storage::Container.metadata_response
13
+ metadata_response = ApiStub::Requests::Storage::Directory.metadata_response
14
14
  @blob_client.stub :get_container_metadata, @container_object do
15
15
  assert_equal @service.get_container_metadata('Test-container'), metadata_response
16
16
  end