fog-azure-rm 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +13 -8
  4. data/CHANGELOG.md +23 -10
  5. data/CONTRIBUTORS.md +2 -0
  6. data/lib/fog/azurerm/application_gateway.rb +4 -3
  7. data/lib/fog/azurerm/compute.rb +0 -1
  8. data/lib/fog/azurerm/dns.rb +0 -3
  9. data/lib/fog/azurerm/docs/application_gateway.md +72 -2
  10. data/lib/fog/azurerm/docs/compute.md +8 -5
  11. data/lib/fog/azurerm/docs/network.md +185 -6
  12. data/lib/fog/azurerm/docs/resources.md +2 -2
  13. data/lib/fog/azurerm/docs/storage.md +2 -2
  14. data/lib/fog/azurerm/docs/traffic_manager.md +23 -0
  15. data/lib/fog/azurerm/models/application_gateway/gateway.rb +180 -22
  16. data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -2
  17. data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +7 -2
  18. data/lib/fog/azurerm/models/compute/server.rb +5 -2
  19. data/lib/fog/azurerm/models/compute/servers.rb +4 -8
  20. data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +58 -0
  21. data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +31 -0
  22. data/lib/fog/azurerm/models/network/load_balancers.rb +4 -2
  23. data/lib/fog/azurerm/models/network/local_network_gateway.rb +68 -0
  24. data/lib/fog/azurerm/models/network/local_network_gateways.rb +29 -0
  25. data/lib/fog/azurerm/models/network/public_ip.rb +16 -1
  26. data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +93 -0
  27. data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +29 -0
  28. data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +1 -1
  29. data/lib/fog/azurerm/models/resources/deployments.rb +4 -2
  30. data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -2
  31. data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -2
  32. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +23 -6
  33. data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +29 -3
  34. data/lib/fog/azurerm/network.rb +23 -3
  35. data/lib/fog/azurerm/requests/application_gateway/{create_application_gateway.rb → create_or_update_application_gateway.rb} +23 -63
  36. data/lib/fog/azurerm/requests/application_gateway/get_application_gateway.rb +159 -0
  37. data/lib/fog/azurerm/requests/application_gateway/update_sku_attributes.rb +28 -0
  38. data/lib/fog/azurerm/requests/application_gateway/update_subnet_id_in_gateway_ip_configuration.rb +29 -0
  39. data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +31 -20
  40. data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +1 -1
  41. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
  42. data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb +49 -0
  43. data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +78 -0
  44. data/lib/fog/azurerm/requests/network/{create_public_ip.rb → create_or_update_public_ip.rb} +22 -8
  45. data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +81 -0
  46. data/lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb +28 -0
  47. data/lib/fog/azurerm/requests/network/delete_local_network_gateway.rb +28 -0
  48. data/lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb +28 -0
  49. data/lib/fog/azurerm/requests/network/get_connection_shared_key.rb +25 -0
  50. data/lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb +34 -0
  51. data/lib/fog/azurerm/requests/network/get_load_balancer.rb +169 -0
  52. data/lib/fog/azurerm/requests/network/get_local_network_gateway.rb +46 -0
  53. data/lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb +46 -0
  54. data/lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb +36 -0
  55. data/lib/fog/azurerm/requests/network/list_local_network_gateways.rb +49 -0
  56. data/lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb +49 -0
  57. data/lib/fog/azurerm/requests/network/reset_connection_shared_key.rb +36 -0
  58. data/lib/fog/azurerm/requests/network/set_connection_shared_key.rb +36 -0
  59. data/lib/fog/azurerm/requests/resources/create_deployment.rb +5 -4
  60. data/lib/fog/azurerm/requests/resources/create_resource_group.rb +5 -4
  61. data/lib/fog/azurerm/requests/resources/delete_deployment.rb +5 -4
  62. data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +5 -4
  63. data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +6 -4
  64. data/lib/fog/azurerm/requests/resources/get_deployment.rb +81 -0
  65. data/lib/fog/azurerm/requests/resources/get_resource_group.rb +47 -0
  66. data/lib/fog/azurerm/requests/resources/list_deployments.rb +5 -4
  67. data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +6 -5
  68. data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +5 -4
  69. data/lib/fog/azurerm/requests/resources/tag_resource.rb +6 -4
  70. data/lib/fog/azurerm/requests/storage/get_storage_account.rb +36 -0
  71. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_endpoint.rb → create_or_update_traffic_manager_endpoint.rb} +2 -2
  72. data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_profile.rb → create_or_update_traffic_manager_profile.rb} +6 -6
  73. data/lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb +1 -1
  74. data/lib/fog/azurerm/resources.rb +2 -3
  75. data/lib/fog/azurerm/storage.rb +1 -1
  76. data/lib/fog/azurerm/traffic_manager.rb +2 -3
  77. data/lib/fog/azurerm/utilities/general.rb +5 -0
  78. data/lib/fog/azurerm/version.rb +1 -1
  79. data/lib/fog/azurerm.rb +34 -32
  80. data/test/api_stub/models/application_gateway/gateway.rb +29 -0
  81. data/test/api_stub/models/network/express_route_circuit_authorization.rb +22 -0
  82. data/test/api_stub/models/network/local_network_gateway.rb +31 -0
  83. data/test/api_stub/models/network/virtual_network_gateway_connection.rb +31 -0
  84. data/test/api_stub/requests/application_gateway/gateway.rb +30 -0
  85. data/test/api_stub/requests/compute/virtual_machine.rb +129 -2
  86. data/test/api_stub/requests/network/express_route_circuit_authorization.rb +31 -0
  87. data/test/api_stub/requests/network/local_network_gateway.rb +62 -0
  88. data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +68 -0
  89. data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +13 -0
  90. data/test/api_stub.rb +97 -48
  91. data/test/integration/Virtual_network_gateway_connection.rb +212 -0
  92. data/test/integration/application_gateway.rb +125 -54
  93. data/test/integration/deployment.rb +1 -1
  94. data/test/integration/express_route_circuit.rb +43 -4
  95. data/test/integration/external_load_balancer.rb +4 -4
  96. data/test/integration/internal_load_balancer.rb +4 -4
  97. data/test/integration/local_network_gateway.rb +76 -0
  98. data/test/integration/public_ip.rb +7 -0
  99. data/test/integration/server.rb +5 -4
  100. data/test/integration/storage_account.rb +5 -5
  101. data/test/integration/traffic_manager.rb +21 -0
  102. data/test/integration/virtual_network_gateway.rb +51 -22
  103. data/test/models/application_gateway/test_gateway.rb +56 -1
  104. data/test/models/application_gateway/test_gateways.rb +5 -5
  105. data/test/models/compute/test_servers.rb +6 -14
  106. data/test/models/network/test_express_route_circuit_authorization.rb +50 -0
  107. data/test/models/network/test_express_route_circuit_authorizations.rb +43 -0
  108. data/test/models/network/test_load_balancers.rb +6 -6
  109. data/test/models/network/test_local_network_gateway.rb +53 -0
  110. data/test/models/network/test_local_network_gateways.rb +42 -0
  111. data/test/models/network/test_public_ip.rb +16 -12
  112. data/test/models/network/test_virtual_network_gateway_connection.rb +59 -0
  113. data/test/models/network/test_virtual_network_gateway_connections.rb +42 -0
  114. data/test/models/resources/test_deployments.rb +5 -5
  115. data/test/models/resources/test_resource_groups.rb +5 -5
  116. data/test/models/storage/test_storage_accounts.rb +3 -3
  117. data/test/models/traffic_manager/test_traffic_manager_end_point.rb +1 -1
  118. data/test/models/traffic_manager/test_traffic_manager_profile.rb +11 -4
  119. data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +35 -0
  120. data/test/requests/application_gateway/test_get_application_gateway.rb +24 -0
  121. data/test/requests/compute/test_create_virtual_machine.rb +17 -2
  122. data/test/requests/network/test_create_express_route_circuit_authorization.rb +35 -0
  123. data/test/requests/network/test_create_or_update_local_network_gateway.rb +36 -0
  124. data/test/requests/network/test_create_public_ip.rb +3 -3
  125. data/test/requests/network/test_create_virtual_network_gateway_connection.rb +36 -0
  126. data/test/requests/network/test_delete_express_route_circuit_authorization.rb +23 -0
  127. data/test/requests/network/test_delete_local_network_gateway.rb +23 -0
  128. data/test/requests/network/test_delete_virtual_network_gateway.rb +2 -2
  129. data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +23 -0
  130. data/test/requests/network/test_get_connection_shared_key.rb +24 -0
  131. data/test/requests/network/test_get_express_route_circuit_authorization.rb +24 -0
  132. data/test/requests/network/test_get_load_balancer.rb +24 -0
  133. data/test/requests/network/test_get_local_network_gateway.rb +24 -0
  134. data/test/requests/network/test_get_virtual_network_gateway_connection.rb +24 -0
  135. data/test/requests/network/test_list_express_route_circuit_authorizations.rb +24 -0
  136. data/test/requests/network/test_list_local_network_gateways.rb +24 -0
  137. data/test/requests/network/test_list_virtual_network_gateway_connections.rb +24 -0
  138. data/test/requests/network/test_reset_connection_shared_key.rb +23 -0
  139. data/test/requests/network/test_set_connection_shared_key.rb +23 -0
  140. data/test/requests/network/test_update_public_ip.rb +34 -0
  141. data/test/requests/resources/test_create_deployment.rb +1 -1
  142. data/test/requests/resources/test_create_resource_group.rb +1 -1
  143. data/test/requests/resources/test_delete_deployment.rb +1 -1
  144. data/test/requests/resources/test_delete_resource_group.rb +1 -1
  145. data/test/requests/resources/test_delete_resource_tag.rb +1 -1
  146. data/test/requests/resources/test_get_deployment.rb +24 -0
  147. data/test/requests/resources/test_get_resource_group.rb +24 -0
  148. data/test/requests/resources/test_list_deployments.rb +1 -1
  149. data/test/requests/resources/test_list_resource_groups.rb +1 -1
  150. data/test/requests/resources/test_list_tagged_resources.rb +1 -1
  151. data/test/requests/resources/test_tag_resource.rb +1 -1
  152. data/test/requests/storage/test_get_storage_account.rb +25 -0
  153. data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +2 -2
  154. data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +3 -3
  155. data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +27 -0
  156. data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +27 -0
  157. data/test/test_helper.rb +52 -0
  158. metadata +73 -9
  159. data/lib/fog/azurerm/core.rb +0 -14
  160. data/test/requests/application_gateway/test_create_application_gateway.rb +0 -51
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Virtual Network Gateway Connection Request
4
+ class TestGetVirtualNetworkGatewayConnection < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @gateway_connections = @network_client.virtual_network_gateway_connections
9
+ end
10
+
11
+ def test_get_virtual_network_gateway_connection_success
12
+ mocked_response = ApiStub::Requests::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
13
+ @gateway_connections.stub :get, mocked_response do
14
+ assert_equal @service.get_virtual_network_gateway_connection('fog-test-rg', 'fog-test-gateway-connection'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_virtual_network_gateway_connection_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @gateway_connections.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_virtual_network_gateway_connection('fog-test-rg', 'fog-test-gateway-connection') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for List Express Route Circuit Authorization Request
4
+ class TestListExpressRouteCircuitAuthorization < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @circuit_authorization = @network_client.express_route_circuit_authorizations
9
+ end
10
+
11
+ def test_list_express_route_circuit_authorizations_success
12
+ mocked_response = [ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)]
13
+ @circuit_authorization.stub :list, mocked_response do
14
+ assert_equal @service.list_express_route_circuit_authorizations('fogRM-rg', 'testCircuit'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_list_express_route_circuit_authorizations_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @circuit_authorization.stub :list, response do
21
+ assert_raises(RuntimeError) { @service.list_express_route_circuit_authorizations('fogRM-rg', 'testCircuit') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for List Local Network Gateways Request
4
+ class TestListLocalNetwrokGateways < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @local_network_gateways = @network_client.local_network_gateways
9
+ end
10
+
11
+ def test_list_local_network_gateways_success
12
+ mocked_response = ApiStub::Requests::Network::LocalNetworkGateway.list_local_network_gateway_response(@network_client)
13
+ @local_network_gateways.stub :list_as_lazy, mocked_response do
14
+ assert_equal @service.list_local_network_gateways('fog-test-rg'), mocked_response.value
15
+ end
16
+ end
17
+
18
+ def test_list_local_network_gateways_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @local_network_gateways.stub :list_as_lazy, response do
21
+ assert_raises(RuntimeError) { @service.list_local_network_gateways('fog-test-rg') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for List Virtual Network Gateway Connections Request
4
+ class TestListVirtualNetwrokGatewayConnections < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @gateway_connections = @network_client.virtual_network_gateway_connections
9
+ end
10
+
11
+ def test_list_virtual_network_gateway_connections_success
12
+ mocked_response = ApiStub::Requests::Network::VirtualNetworkGatewayConnection.list_virtual_network_gateway_connection_response(@network_client)
13
+ @gateway_connections.stub :list_as_lazy, mocked_response do
14
+ assert_equal @service.list_virtual_network_gateway_connections('fog-test-rg'), mocked_response.value
15
+ end
16
+ end
17
+
18
+ def test_list_virtual_network_gateway_connections_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @gateway_connections.stub :list_as_lazy, response do
21
+ assert_raises(RuntimeError) { @service.list_virtual_network_gateway_connections('fog-test-rg') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Set Connection Shared Key Request
4
+ class TestResetConnectionSharedKey < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @gateway_connections = @network_client.virtual_network_gateway_connections
9
+ end
10
+
11
+ def test_reset_connection_shared_key_success
12
+ @gateway_connections.stub :reset_shared_key, nil do
13
+ assert_equal @service.reset_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', '20'), true
14
+ end
15
+ end
16
+
17
+ def test_reset_connection_shared_key_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @gateway_connections.stub :reset_shared_key, response do
20
+ assert_raises(RuntimeError) { @service.reset_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', '20') }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Set Connection Shared Key Request
4
+ class TestSetConnectionSharedKey < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @gateway_connections = @network_client.virtual_network_gateway_connections
9
+ end
10
+
11
+ def test_set_connection_shared_key_success
12
+ @gateway_connections.stub :set_shared_key, nil do
13
+ assert_equal @service.set_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', 'hello'), true
14
+ end
15
+ end
16
+
17
+ def test_set_connection_shared_key_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @gateway_connections.stub :set_shared_key, response do
20
+ assert_raises(RuntimeError) { @service.set_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', 'hello') }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test Class for Update Public IP Request
4
+ class TestUpdatePublicIp < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ network_client = @service.instance_variable_get(:@network_client)
8
+ @public_ips = network_client.public_ipaddresses
9
+ @response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(network_client)
10
+ end
11
+
12
+ def test_update_public_ip_success
13
+ @public_ips.stub :create_or_update, @response do
14
+ assert_equal @service.create_or_update_public_ip('TestRG', 'testPubIp432', 'West US', 'Dynamic', '4', 'mylabel'), @response
15
+ end
16
+ end
17
+
18
+ def test_update_public_ip_argument_error_failure
19
+ @public_ips.stub :create_or_update, @response do
20
+ assert_raises ArgumentError do
21
+ @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US')
22
+ end
23
+ end
24
+ end
25
+
26
+ def test_update_public_ip_exception_failure
27
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
28
+ @public_ips.stub :create_or_update, response do
29
+ assert_raises RuntimeError do
30
+ @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '4', 'mylabel')
31
+ end
32
+ end
33
+ end
34
+ end
@@ -25,7 +25,7 @@ class TestCreateDeployment < Minitest::Test
25
25
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
26
26
  @deployments.stub :validate, true do
27
27
  @deployments.stub :create_or_update, response do
28
- assert_raises(Fog::AzureRm::OperationError) { @service.create_deployment(@resource_group, @deployment_name, @template_link, @parameters_link) }
28
+ assert_raises(RuntimeError) { @service.create_deployment(@resource_group, @deployment_name, @template_link, @parameters_link) }
29
29
  end
30
30
  end
31
31
  end
@@ -18,7 +18,7 @@ class TestCreateResourceGroup < Minitest::Test
18
18
  def test_create_resource_group_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
20
  @resource_groups.stub :create_or_update, response do
21
- assert_raises(Fog::AzureRm::OperationError) { @service.create_resource_group('fog-test-rg', 'west us') }
21
+ assert_raises(RuntimeError) { @service.create_resource_group('fog-test-rg', 'west us') }
22
22
  end
23
23
  end
24
24
  end
@@ -19,7 +19,7 @@ class TestDeleteDeployment < Minitest::Test
19
19
  def test_list_deployment_failure
20
20
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
21
  @deployments.stub :delete, response do
22
- assert_raises(Fog::AzureRm::OperationError) { @service.delete_deployment(@resource_group, @deployment_name) }
22
+ assert_raises(RuntimeError) { @service.delete_deployment(@resource_group, @deployment_name) }
23
23
  end
24
24
  end
25
25
  end
@@ -18,7 +18,7 @@ class TestDeleteResourceGroup < Minitest::Test
18
18
  def test_delete_resource_group_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
20
  @resource_groups.stub :delete, response do
21
- assert_raises(Fog::AzureRm::OperationError) { @service.delete_resource_group('fog-test-rg') }
21
+ assert_raises(RuntimeError) { @service.delete_resource_group('fog-test-rg') }
22
22
  end
23
23
  end
24
24
  end
@@ -23,7 +23,7 @@ class TestDeleteResourceTag < Minitest::Test
23
23
  @resources.stub :get, @resource_response do
24
24
  @resources.stub :create_or_update, response do
25
25
  resource_id = '/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}'
26
- assert_raises(Fog::AzureRm::OperationError) { @service.delete_resource_tag(resource_id, 'tag_name', 'tag_value') }
26
+ assert_raises(RuntimeError) { @service.delete_resource_tag(resource_id, 'tag_name', 'tag_value') }
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Deployment Request
4
+ class TestGetDeployment < Minitest::Test
5
+ def setup
6
+ @service = Fog::Resources::AzureRM.new(credentials)
7
+ @rmc_client = @service.instance_variable_get(:@rmc)
8
+ @deployments = @rmc_client.deployments
9
+ end
10
+
11
+ def test_list_deployment_success
12
+ mocked_response = ApiStub::Requests::Resources::Deployment.create_deployment_response(@rmc_client)
13
+ @deployments.stub :get, mocked_response do
14
+ assert_equal @service.get_deployment('fog-test-rg', 'fog-test-deployment'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_list_deployment_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @deployments.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_deployment('fog-test-rg', 'fog-test-deployment') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Resource Group Request
4
+ class TestGetResourceGroup < Minitest::Test
5
+ def setup
6
+ @service = Fog::Resources::AzureRM.new(credentials)
7
+ @rmc_client = @service.instance_variable_get(:@rmc)
8
+ @resource_groups = @rmc_client.resource_groups
9
+ end
10
+
11
+ def test_get_resource_group_success
12
+ mocked_response = ApiStub::Requests::Resources::ResourceGroup.create_resource_group_response(@rmc_client)
13
+ @resource_groups.stub :get, mocked_response do
14
+ assert_equal @service.get_resource_group('fog-test-rg'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_resource_group_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @resource_groups.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_resource_group('fog-test-rg') }
22
+ end
23
+ end
24
+ end
@@ -19,7 +19,7 @@ class TestListDeployment < Minitest::Test
19
19
  def test_list_deployment_failure
20
20
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
21
  @deployments.stub :list_as_lazy, response do
22
- assert_raises(Fog::AzureRm::OperationError) { @service.list_deployments(@resource_group) }
22
+ assert_raises(RuntimeError) { @service.list_deployments(@resource_group) }
23
23
  end
24
24
  end
25
25
  end
@@ -18,7 +18,7 @@ class TestListResourceGroups < Minitest::Test
18
18
  def test_list_resource_group_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
20
  @resource_groups.stub :list_as_lazy, response do
21
- assert_raises(Fog::AzureRm::OperationError) { @service.list_resource_groups }
21
+ assert_raises(RuntimeError) { @service.list_resource_groups }
22
22
  end
23
23
  end
24
24
  end
@@ -18,7 +18,7 @@ class TestListTags < Minitest::Test
18
18
  def test_list_tagged_resources_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
20
  @resources.stub :list_as_lazy, response do
21
- assert_raises(Fog::AzureRm::OperationError) { @service.list_tagged_resources('test_key') }
21
+ assert_raises(RuntimeError) { @service.list_tagged_resources('test_key') }
22
22
  end
23
23
  end
24
24
  end
@@ -23,7 +23,7 @@ class TestTagResource < Minitest::Test
23
23
  @resources.stub :get, @resource_response do
24
24
  @resources.stub :create_or_update, response do
25
25
  resource_id = '/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}'
26
- assert_raises(Fog::AzureRm::OperationError) { @service.tag_resource(resource_id, 'tag_name', 'tag_value') }
26
+ assert_raises(RuntimeError) { @service.tag_resource(resource_id, 'tag_name', 'tag_value') }
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,25 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test Class for Get Storage Account Request
4
+ class TestGetStorageAccount < Minitest::Test
5
+ # This class posesses the test cases for the requests of storage account service.
6
+ def setup
7
+ @service = Fog::Storage::AzureRM.new(credentials)
8
+ @storage_mgmt_client = @service.instance_variable_get(:@storage_mgmt_client)
9
+ @storage_accounts = @storage_mgmt_client.storage_accounts
10
+ end
11
+
12
+ def test_get_storage_account_success
13
+ response_body = ApiStub::Requests::Storage::StorageAccount.storage_account_request(@storage_mgmt_client)
14
+ @storage_accounts.stub :get_properties, response_body do
15
+ assert_equal @service.get_storage_account('fog_test_rg', 'fogtestsasecond'), response_body
16
+ end
17
+ end
18
+
19
+ def test_list_storage_accounts_exeception
20
+ raise_exception = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
+ @storage_accounts.stub :get_properties, raise_exception do
22
+ assert_raises(RuntimeError) { @service.get_storage_account('fog_test_rg', 'fogtestsasecond') }
23
+ end
24
+ end
25
+ end
@@ -12,14 +12,14 @@ class TestCreateTrafficManagerEndPoint < Minitest::Test
12
12
  def test_create_traffic_manager_endpoint_success
13
13
  mocked_response = ApiStub::Requests::TrafficManager::TrafficManagerEndPoint.create_traffic_manager_endpoint_response(@traffic_manager_client)
14
14
  @end_points.stub :create_or_update, mocked_response do
15
- assert_equal @service.create_traffic_manager_endpoint(@endpoint_hash), mocked_response
15
+ assert_equal @service.create_or_update_traffic_manager_endpoint(@endpoint_hash), mocked_response
16
16
  end
17
17
  end
18
18
 
19
19
  def test_create_traffic_manager_endpoint_failure
20
20
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
21
  @end_points.stub :create_or_update, response do
22
- assert_raises(RuntimeError) { @service.create_traffic_manager_endpoint(@endpoint_hash) }
22
+ assert_raises(RuntimeError) { @service.create_or_update_traffic_manager_endpoint(@endpoint_hash) }
23
23
  end
24
24
  end
25
25
  end
@@ -6,20 +6,20 @@ class TestCreateTrafficManagerProfile < Minitest::Test
6
6
  @service = Fog::TrafficManager::AzureRM.new(credentials)
7
7
  @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
8
8
  @profiles = @traffic_manager_client.profiles
9
+ @profile_hash = ApiStub::Requests::TrafficManager::TrafficManagerProfile.profile_hash
9
10
  end
10
11
 
11
12
  def test_create_traffic_manager_profile_success
12
13
  mocked_response = ApiStub::Requests::TrafficManager::TrafficManagerProfile.create_traffic_manager_profile_response(@traffic_manager_client)
13
14
  @profiles.stub :create_or_update, mocked_response do
14
- assert_equal @service.create_traffic_manager_profile('fog-test-rg', 'fog-test-profile', 'Performance',
15
- 'fog-test-app', 30, 'http', 80, '/monitorpage.aspx'), mocked_response
15
+ assert_equal @service.create_or_update_traffic_manager_profile(@profile_hash), mocked_response
16
16
  end
17
17
  end
18
18
 
19
19
  def test_create_traffic_manager_profile_failure
20
20
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
21
  @profiles.stub :create_or_update, response do
22
- assert_raises(RuntimeError) { @service.create_traffic_manager_profile('fog-test-rg', 'fog-test-profile', 'Performance', 'fog-test-app', 30, 'http', 80, '/monitorpage.aspx') }
22
+ assert_raises(RuntimeError) { @service.create_or_update_traffic_manager_profile(@profile_hash) }
23
23
  end
24
24
  end
25
25
  end
@@ -0,0 +1,27 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Update Traffic Manager End Point
4
+ class TestUpdateTrafficManagerEndPoint < Minitest::Test
5
+ def setup
6
+ @service = Fog::TrafficManager::AzureRM.new(credentials)
7
+ @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
8
+ @end_points = @traffic_manager_client.endpoints
9
+ @mocked_response = ApiStub::Requests::TrafficManager::TrafficManagerEndPoint.create_traffic_manager_endpoint_response(@traffic_manager_client)
10
+ end
11
+
12
+ def test_update_traffic_manager_profile_success
13
+ @endpoint_hash = ApiStub::Requests::TrafficManager::TrafficManagerEndPoint.endpoint_hash
14
+ @end_points.stub :create_or_update, @mocked_response do
15
+ assert_equal @service.create_or_update_traffic_manager_endpoint(@endpoint_hash), @mocked_response
16
+ end
17
+ end
18
+
19
+ def test_update_traffic_manager_profile_exception_failure
20
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
+ @end_points.stub :create_or_update, response do
22
+ assert_raises RuntimeError do
23
+ @service.create_or_update_traffic_manager_endpoint(resource_group: 'resource-group', name: 'name', traffic_manager_profile_name: 'traffic_manager_profile_name', type: 'type')
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Update Traffic Manager Profile
4
+ class TestUpdateTrafficManagerProfile < Minitest::Test
5
+ def setup
6
+ @service = Fog::TrafficManager::AzureRM.new(credentials)
7
+ @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
8
+ @profiles = @traffic_manager_client.profiles
9
+ @mocked_response = ApiStub::Requests::TrafficManager::TrafficManagerProfile.create_traffic_manager_profile_response(@traffic_manager_client)
10
+ @profile_hash = ApiStub::Requests::TrafficManager::TrafficManagerProfile.profile_hash
11
+ end
12
+
13
+ def test_update_traffic_manager_profile_success
14
+ @profiles.stub :create_or_update, @mocked_response do
15
+ assert_equal @service.create_or_update_traffic_manager_profile(@profile_hash), @mocked_response
16
+ end
17
+ end
18
+
19
+ def test_update_traffic_manager_profile_exception_failure
20
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
21
+ @profiles.stub :create_or_update, response do
22
+ assert_raises RuntimeError do
23
+ @service.create_or_update_traffic_manager_profile(resource_group: 'fog-test-rg')
24
+ end
25
+ end
26
+ end
27
+ end
data/test/test_helper.rb CHANGED
@@ -494,6 +494,24 @@ def virtual_network_gateway(service)
494
494
  )
495
495
  end
496
496
 
497
+ def local_network_gateway(service)
498
+ Fog::Network::AzureRM::LocalNetworkGateway.new(
499
+ name: 'testLocalNetworkGateway',
500
+ location: 'eastus',
501
+ tags: {
502
+ key1: 'value1',
503
+ key2: 'value2'
504
+ },
505
+ resource_group: 'learn_fog',
506
+ gateway_ip_address: '192.168.1.1',
507
+ local_network_address_space_prefixes: [],
508
+ asn: 100,
509
+ bgp_peering_address: '192.168.1.2',
510
+ peer_weight: 3,
511
+ service: service
512
+ )
513
+ end
514
+
497
515
  def express_route_circuit(service)
498
516
  Fog::Network::AzureRM::ExpressRouteCircuit.new(
499
517
  name: 'testCircuit',
@@ -535,3 +553,37 @@ def express_route_circuit_peering(service)
535
553
  service: service
536
554
  )
537
555
  end
556
+
557
+ def express_route_circuit_authorization(service)
558
+ Fog::Network::AzureRM::ExpressRouteCircuitAuthorization.new(
559
+ name: 'UniqueAuthorizationName',
560
+ circuit_name: 'testCircuit',
561
+ resource_group: 'HaiderRG',
562
+ authorization_use_status: 'Available',
563
+ authorization_name: 'circuit-auth-name',
564
+ service: service
565
+ )
566
+ end
567
+
568
+ def virtual_network_gateway_connection(service)
569
+ Fog::Network::AzureRM::VirtualNetworkGatewayConnection.new(
570
+ name: 'testNetworkGateway',
571
+ location: 'eastus',
572
+ tags: {
573
+ key1: 'value1',
574
+ key2: 'value2'
575
+ },
576
+ resource_group: 'learn_fog',
577
+ virtual_network_gateway1: {
578
+ name: 'firstgateway'
579
+ },
580
+ virtual_network_gateway2: {
581
+ name: 'secondgateway'
582
+ },
583
+ enable_bgp: true,
584
+ connection_type: 'VNet-to-VNet',
585
+ routing_weight: 2,
586
+ shared_key: 'shared_key',
587
+ service: service
588
+ )
589
+ end