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,59 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for VirtualNetworkGatewayConnection Model
4
+ class TestVirtualNetworkGatewayConnection < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @gateway_connection = virtual_network_gateway_connection(@service)
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ end
10
+
11
+ def test_model_methods
12
+ methods = [
13
+ :save,
14
+ :destroy
15
+ ]
16
+ methods.each do |method|
17
+ assert @gateway_connection.respond_to? method
18
+ end
19
+ end
20
+
21
+ def test_model_attributes
22
+ attributes = [
23
+ :name,
24
+ :id,
25
+ :location,
26
+ :resource_group,
27
+ :tags,
28
+ :virtual_network_gateway1,
29
+ :virtual_network_gateway2,
30
+ :local_network_gateway2,
31
+ :enable_bgp,
32
+ :connection_type,
33
+ :authorization_key,
34
+ :routing_weight,
35
+ :shared_key,
36
+ :egress_bytes_transferred,
37
+ :ingress_bytes_transferred,
38
+ :peer,
39
+ :provisioning_state,
40
+ :connection_status
41
+ ]
42
+ attributes.each do |attribute|
43
+ assert @gateway_connection.respond_to? attribute
44
+ end
45
+ end
46
+
47
+ def test_save_method_response
48
+ connection_response = ApiStub::Models::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
49
+ @service.stub :create_or_update_virtual_network_gateway_connection, connection_response do
50
+ assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, @gateway_connection.save
51
+ end
52
+ end
53
+
54
+ def test_destroy_method_response
55
+ @service.stub :delete_virtual_network_gateway_connection, true do
56
+ assert @gateway_connection.destroy
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,42 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for VirtualNetworkGatewayConnection Collection
4
+ class TestVirtualNetworkGatewayConnections < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @gateway_connections = Fog::Network::AzureRM::VirtualNetworkGatewayConnections.new(resource_group: 'fog-rg', service: @service)
8
+ @network_client = @service.instance_variable_get(:@network_client)
9
+ @response = ApiStub::Models::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
10
+ end
11
+
12
+ def test_collection_methods
13
+ methods = [
14
+ :all,
15
+ :get
16
+ ]
17
+ methods.each do |method|
18
+ assert @gateway_connections.respond_to? method
19
+ end
20
+ end
21
+
22
+ def test_collection_attributes
23
+ assert @gateway_connections.respond_to? :resource_group
24
+ end
25
+
26
+ def test_all_method_response
27
+ connection_response = [@response]
28
+ @service.stub :list_virtual_network_gateway_connections, connection_response do
29
+ assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnections, @gateway_connections.all
30
+ assert @gateway_connections.all.size >= 1
31
+ @gateway_connections.all.each do |gateway_connection|
32
+ assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, gateway_connection
33
+ end
34
+ end
35
+ end
36
+
37
+ def test_get_method_response
38
+ @service.stub :get_virtual_network_gateway_connection, @response do
39
+ assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, @gateway_connections.get('fog-rg', 'cn1')
40
+ end
41
+ end
42
+ end
@@ -4,9 +4,9 @@ require File.expand_path '../../test_helper', __dir__
4
4
  class TestDeployments < Minitest::Test
5
5
  def setup
6
6
  @service = Fog::Resources::AzureRM.new(credentials)
7
- client = @service.instance_variable_get(:@rmc)
7
+ @rmc_client = @service.instance_variable_get(:@rmc)
8
8
  @deployments = Fog::Resources::AzureRM::Deployments.new(resource_group: 'fog-test-rg', service: @service)
9
- @response = ApiStub::Models::Resources::Deployment.list_deployments_response(client)
9
+ @response = ApiStub::Models::Resources::Deployment.list_deployments_response(@rmc_client)
10
10
  end
11
11
 
12
12
  def test_collection_methods
@@ -30,9 +30,9 @@ class TestDeployments < Minitest::Test
30
30
  end
31
31
 
32
32
  def test_get_method_response
33
- @service.stub :list_deployments, @response do
34
- assert_instance_of Fog::Resources::AzureRM::Deployment, @deployments.get('fog-test-deployment')
35
- assert @deployments.get('wrong-name').nil?
33
+ response = ApiStub::Models::Resources::Deployment.create_deployment_response(@rmc_client)
34
+ @service.stub :get_deployment, response do
35
+ assert_instance_of Fog::Resources::AzureRM::Deployment, @deployments.get('fog-test-rg', 'fog-test-deployment')
36
36
  end
37
37
  end
38
38
  end
@@ -4,9 +4,9 @@ require File.expand_path '../../test_helper', __dir__
4
4
  class TestResourceGroups < Minitest::Test
5
5
  def setup
6
6
  @service = Fog::Resources::AzureRM.new(credentials)
7
- client = @service.instance_variable_get(:@rmc)
7
+ @rmc_client = @service.instance_variable_get(:@rmc)
8
8
  @resource_groups = Fog::Resources::AzureRM::ResourceGroups.new(service: @service)
9
- @response = [ApiStub::Models::Resources::ResourceGroup.create_resource_group_response(client)]
9
+ @response = ApiStub::Models::Resources::ResourceGroup.create_resource_group_response(@rmc_client)
10
10
  end
11
11
 
12
12
  def test_collection_methods
@@ -20,7 +20,8 @@ class TestResourceGroups < Minitest::Test
20
20
  end
21
21
 
22
22
  def test_all_method_response
23
- @service.stub :list_resource_groups, @response do
23
+ response = [@response]
24
+ @service.stub :list_resource_groups, response do
24
25
  assert_instance_of Fog::Resources::AzureRM::ResourceGroups, @resource_groups.all
25
26
  assert @resource_groups.all.size >= 1
26
27
  @resource_groups.all.each do |s|
@@ -30,9 +31,8 @@ class TestResourceGroups < Minitest::Test
30
31
  end
31
32
 
32
33
  def test_get_method_response
33
- @service.stub :list_resource_groups, @response do
34
+ @service.stub :get_resource_group, @response do
34
35
  assert_instance_of Fog::Resources::AzureRM::ResourceGroup, @resource_groups.get('fog-test-rg')
35
- assert @resource_groups.get('wrong-name').nil?
36
36
  end
37
37
  end
38
38
  end
@@ -45,9 +45,9 @@ class TestStorageAccounts < Minitest::Test
45
45
  end
46
46
 
47
47
  def test_get_method_response
48
- @service.stub :list_storage_account_for_rg, @list_storage_account_response do
49
- assert_instance_of Fog::Storage::AzureRM::StorageAccount, @storage_accounts.get('fog-test-storage-account')
50
- assert @storage_accounts.get('wrong-name').nil?, true
48
+ response = ApiStub::Models::Storage::StorageAccount.create_storage_account(@storage_mgmt_client)
49
+ @service.stub :get_storage_account, response do
50
+ assert_instance_of Fog::Storage::AzureRM::StorageAccount, @storage_accounts.get('fog-test-rg', 'fog-test-storage-account')
51
51
  end
52
52
  end
53
53
 
@@ -41,7 +41,7 @@ class TestTrafficManagerEndPoint < Minitest::Test
41
41
 
42
42
  def test_save_method_response
43
43
  response = ApiStub::Models::TrafficManager::TrafficManagerEndPoint.create_traffic_manager_end_point_response(@traffic_manager_client)
44
- @service.stub :create_traffic_manager_endpoint, response do
44
+ @service.stub :create_or_update_traffic_manager_endpoint, response do
45
45
  assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerEndPoint, @traffic_manager_end_point.save
46
46
  end
47
47
  end
@@ -5,14 +5,15 @@ class TestTrafficManagerProfile < Minitest::Test
5
5
  def setup
6
6
  @service = Fog::TrafficManager::AzureRM.new(credentials)
7
7
  @traffic_manager_profile = traffic_manager_profile(@service)
8
- traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
9
- @traffic_manager_profile_response = ApiStub::Models::TrafficManager::TrafficManagerProfile.traffic_manager_profile_response(traffic_manager_client)
8
+ @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
9
+ @traffic_manager_profile_response = ApiStub::Models::TrafficManager::TrafficManagerProfile.traffic_manager_profile_response(@traffic_manager_client)
10
10
  end
11
11
 
12
12
  def test_model_methods
13
13
  methods = [
14
14
  :save,
15
- :destroy
15
+ :destroy,
16
+ :update
16
17
  ]
17
18
  methods.each do |method|
18
19
  assert @traffic_manager_profile.respond_to? method
@@ -42,11 +43,17 @@ class TestTrafficManagerProfile < Minitest::Test
42
43
  end
43
44
 
44
45
  def test_save_method_response
45
- @service.stub :create_traffic_manager_profile, @traffic_manager_profile_response do
46
+ @service.stub :create_or_update_traffic_manager_profile, @traffic_manager_profile_response do
46
47
  assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, @traffic_manager_profile.save
47
48
  end
48
49
  end
49
50
 
51
+ def test_update_method_response
52
+ @service.stub :create_or_update_traffic_manager_profile, @traffic_manager_profile_response do
53
+ assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, @traffic_manager_profile.update({})
54
+ end
55
+ end
56
+
50
57
  def test_destroy_method_response
51
58
  @service.stub :delete_traffic_manager_profile, true do
52
59
  assert @traffic_manager_profile.destroy
@@ -0,0 +1,35 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Create Application Gateway Request
4
+ class TestCreateOrUpdateApplicationGateway < Minitest::Test
5
+ def setup
6
+ @service = Fog::ApplicationGateway::AzureRM.new(credentials)
7
+ gateway_client = @service.instance_variable_get(:@network_client)
8
+ @gateways = gateway_client.application_gateways
9
+ @response = ApiStub::Requests::ApplicationGateway::Gateway.create_application_gateway_response(gateway_client)
10
+ @gateway_params = ApiStub::Requests::ApplicationGateway::Gateway.gateway_params
11
+ end
12
+
13
+ def test_create_or_update_application_gateway_success
14
+ @gateways.stub :create_or_update, @response do
15
+ assert_equal @service.create_or_update_application_gateway(@gateway_params), @response
16
+ end
17
+ end
18
+
19
+ def test_create_or_update_application_gateway_argument_error_failure
20
+ @gateways.stub :create_or_update, @response do
21
+ assert_raises ArgumentError do
22
+ @service.create_or_update_application_gateway('gateway', 'East US', 'fogRM-rg', 'Standard_Medium', 'Standard', 2)
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_create_or_update_application_gateway_exception_failure
28
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
29
+ @gateways.stub :create_or_update, response do
30
+ assert_raises RuntimeError do
31
+ @service.create_or_update_application_gateway(@gateway_params)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Application Gateway Request
4
+ class TestGetApplicationGateway < Minitest::Test
5
+ def setup
6
+ @service = Fog::ApplicationGateway::AzureRM.new(credentials)
7
+ @gateway_client = @service.instance_variable_get(:@network_client)
8
+ @gateways = @gateway_client.application_gateways
9
+ end
10
+
11
+ def test_get_application_gateway_success
12
+ mocked_response = ApiStub::Requests::ApplicationGateway::Gateway.create_application_gateway_response(@gateway_client)
13
+ @gateways.stub :get, mocked_response do
14
+ assert_equal @service.get_application_gateway('fog-test-rg', 'fogRM-rg'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_application_gateway_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @gateways.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_application_gateway('fog-test-rg', 'fogRM-rg') }
22
+ end
23
+ end
24
+ end
@@ -6,9 +6,9 @@ class TestCreateVirtualMachine < Minitest::Test
6
6
  @service = Fog::Compute::AzureRM.new(credentials)
7
7
  compute_client = @service.instance_variable_get(:@compute_mgmt_client)
8
8
  @virtual_machines = compute_client.virtual_machines
9
- @linux_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_hash
10
- @windows_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_hash
11
9
  @response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_response(compute_client)
10
+ @custom_data_response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_with_custom_data_response(compute_client)
11
+ @linux_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_params
12
12
  end
13
13
 
14
14
  def test_create_linux_virtual_machine_success
@@ -18,11 +18,26 @@ class TestCreateVirtualMachine < Minitest::Test
18
18
  end
19
19
 
20
20
  def test_create_windows_virtual_machine_success
21
+ @windows_virtual_machine_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_params
21
22
  @virtual_machines.stub :create_or_update, @response do
22
23
  assert_equal @service.create_virtual_machine(@windows_virtual_machine_hash), @response
23
24
  end
24
25
  end
25
26
 
27
+ def test_create_linux_virtual_machine_with_custom_data_success
28
+ @linux_virtual_machine_with_custom_data_hash = ApiStub::Requests::Compute::VirtualMachine.linux_virtual_machine_with_custom_data_params
29
+ @virtual_machines.stub :create_or_update, @custom_data_response do
30
+ assert_equal @service.create_virtual_machine(@linux_virtual_machine_with_custom_data_hash), @custom_data_response
31
+ end
32
+ end
33
+
34
+ def test_create_windows_virtual_machine_with_custom_data_success
35
+ @windows_virtual_machine_with_custom_data_hash = ApiStub::Requests::Compute::VirtualMachine.windows_virtual_machine_with_custom_data_params
36
+ @virtual_machines.stub :create_or_update, @custom_data_response do
37
+ assert_equal @service.create_virtual_machine(@windows_virtual_machine_with_custom_data_hash), @custom_data_response
38
+ end
39
+ end
40
+
26
41
  def test_create_virtual_machine_failure
27
42
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
28
43
  @virtual_machines.stub :create_or_update, response do
@@ -0,0 +1,35 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Create Express Route Circuit Authorization Request
4
+ class TestCreateExpressRouteCircuitAuthorization < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @circuit_authorizations = @network_client.express_route_circuit_authorizations
9
+ @auth_params = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.auth_hash
10
+ @mocked_response = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
11
+ end
12
+
13
+ def test_create_express_route_circuit_authorization_success
14
+ @circuit_authorizations.stub :create_or_update, @mocked_response do
15
+ assert_equal @service.create_or_update_express_route_circuit_authorization(@auth_params), @mocked_response
16
+ end
17
+ end
18
+
19
+ def test_create_express_route_circuit_authorization_argument_error_failure
20
+ @circuit_authorizations.stub :create_or_update, @mocked_response do
21
+ assert_raises ArgumentError do
22
+ @service.create_or_update_express_route_circuit_authorization('test-resource-group', 'circuit-name')
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_create_express_route_circuit_authorization_exception_failure
28
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
29
+ @circuit_authorizations.stub :create_or_update, response do
30
+ assert_raises RuntimeError do
31
+ @service.create_or_update_express_route_circuit_authorization(@auth_params)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Create Local Network Gateway Request
4
+ class TestCreateLocalNetworkGateway < 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
+ @response = ApiStub::Requests::Network::LocalNetworkGateway.create_local_network_gateway_response(@network_client)
10
+ end
11
+
12
+ def test_create_local_network_gateway_success
13
+ network_gateway_parms = {}
14
+ @local_network_gateways.stub :create_or_update, @response do
15
+ assert_equal @service.create_or_update_local_network_gateway(network_gateway_parms), @response
16
+ end
17
+ end
18
+
19
+ def test_create_local_network_gateway_argument_error_failure
20
+ @local_network_gateways.stub :create_or_update, @response do
21
+ assert_raises ArgumentError do
22
+ @service.create_or_update_local_network_gateway
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_create_local_network_gateway_exception_failure
28
+ local_network_gateway_parms = {}
29
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
30
+ @local_network_gateways.stub :create_or_update, response do
31
+ assert_raises RuntimeError do
32
+ @service.create_or_update_local_network_gateway(local_network_gateway_parms)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -11,7 +11,7 @@ class TestCreatePublicIp < Minitest::Test
11
11
  def test_create_public_ip_success
12
12
  mocked_response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(@network_client)
13
13
  @public_ips.stub :create_or_update, mocked_response do
14
- assert_equal @service.create_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic'), mocked_response
14
+ assert_equal @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '', ''), mocked_response
15
15
  end
16
16
  end
17
17
 
@@ -19,7 +19,7 @@ class TestCreatePublicIp < Minitest::Test
19
19
  mocked_response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(@network_client)
20
20
  @public_ips.stub :create_or_update, mocked_response do
21
21
  assert_raises ArgumentError do
22
- @service.create_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US')
22
+ @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US')
23
23
  end
24
24
  end
25
25
  end
@@ -28,7 +28,7 @@ class TestCreatePublicIp < Minitest::Test
28
28
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
29
29
  @public_ips.stub :create_or_update, response do
30
30
  assert_raises RuntimeError do
31
- @service.create_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic')
31
+ @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '', '')
32
32
  end
33
33
  end
34
34
  end
@@ -0,0 +1,36 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Create Virtual Network Gateway Connection Request
4
+ class TestCreateVirtualNetworkGatewayConnection < 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
+ @connection_response = ApiStub::Requests::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
10
+ end
11
+
12
+ def test_create_virtual_network_gateway_connection_success
13
+ network_gateway_parms = {}
14
+ @gateway_connections.stub :create_or_update, @connection_response do
15
+ assert_equal @service.create_or_update_virtual_network_gateway_connection(network_gateway_parms), @connection_response
16
+ end
17
+ end
18
+
19
+ def test_create_virtual_network_gateway_connection_argument_error_failure
20
+ @gateway_connections.stub :create_or_update, @connection_response do
21
+ assert_raises ArgumentError do
22
+ @service.create_or_update_virtual_network_gateway_connection
23
+ end
24
+ end
25
+ end
26
+
27
+ def test_create_virtual_network_gateway_connection_exception_failure
28
+ network_gateway_parms = {}
29
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
30
+ @gateway_connections.stub :create_or_update, response do
31
+ assert_raises RuntimeError do
32
+ @service.create_or_update_virtual_network_gateway_connection(network_gateway_parms)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Delete Express Route Circuit Authorization Request
4
+ class TestDeleteExpressRouteCircuitAuthorization < 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_delete_express_route_circuit_authorization_success
12
+ @circuit_authorization.stub :delete, true do
13
+ assert @service.delete_express_route_circuit_authorization('Fog-rg', 'testCircuit', 'auth-name'), true
14
+ end
15
+ end
16
+
17
+ def test_delete_express_route_circuit_authorization_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @circuit_authorization.stub :delete, response do
20
+ assert_raises(RuntimeError) { @service.delete_express_route_circuit_authorization('Fog-rg', 'testCircuit', 'auth-name') }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Delete Local Network Gateway Request
4
+ class TestDeleteLocalNetworkGateway < 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_delete_local_network_gateway_success
12
+ @local_network_gateways.stub :delete, true do
13
+ assert @service.delete_local_network_gateway('fog-test-rg', 'fog-test-local-network-gateway')
14
+ end
15
+ end
16
+
17
+ def test_delete_local_network_gateway_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @local_network_gateways.stub :delete, response do
20
+ assert_raises(RuntimeError) { @service.delete_local_network_gateway('fog-test-rg', 'fog-test-local-network-gateway') }
21
+ end
22
+ end
23
+ end
@@ -8,14 +8,14 @@ class TestDeleteVirtualNetworkGateway < Minitest::Test
8
8
  @network_gateways = client.virtual_network_gateways
9
9
  end
10
10
 
11
- def test_delete_network_interface_success
11
+ def test_delete_virtual_network_gateway_success
12
12
  response = ApiStub::Requests::Network::VirtualNetworkGateway.delete_virtual_network_gateway_response
13
13
  @network_gateways.stub :delete, response do
14
14
  assert @service.delete_virtual_network_gateway('fog-test-rg', 'fog-test-network-gateway'), response
15
15
  end
16
16
  end
17
17
 
18
- def test_delete_network_interface_failure
18
+ def test_delete_virtual_network_gateway_failure
19
19
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
20
  @network_gateways.stub :delete, response do
21
21
  assert_raises(RuntimeError) { @service.delete_virtual_network_gateway('fog-test-rg', 'fog-test-network-gateway') }
@@ -0,0 +1,23 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Delete Virtual Network Gateway Connection Request
4
+ class TestDeleteVirtualNetworkGatewayConnection < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ client = @service.instance_variable_get(:@network_client)
8
+ @gateway_connections = client.virtual_network_gateway_connections
9
+ end
10
+
11
+ def test_delete_virtual_network_gateway_connection_success
12
+ @gateway_connections.stub :delete, true do
13
+ assert @service.delete_virtual_network_gateway_connection('fog-test-rg', 'fog-test-gateway-connection'), true
14
+ end
15
+ end
16
+
17
+ def test_delete_virtual_network_gateway_connection_failure
18
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
19
+ @gateway_connections.stub :delete, response do
20
+ assert_raises(RuntimeError) { @service.delete_virtual_network_gateway_connection('fog-test-rg', 'fog-test-gateway-connection') }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Connection Shared Key Request
4
+ class TestGetConnectionSharedKey < 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_connection_shared_key_success
12
+ mocked_response = ApiStub::Requests::Network::VirtualNetworkGatewayConnection.get_connection_shared_key_response(@network_client)
13
+ @gateway_connections.stub :get_shared_key, mocked_response do
14
+ assert_equal @service.get_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection'), mocked_response.value
15
+ end
16
+ end
17
+
18
+ def test_get_connection_shared_key_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @gateway_connections.stub :get_shared_key, response do
21
+ assert_raises(RuntimeError) { @service.get_connection_shared_key('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 Get Express Route Circuit Authorization Request
4
+ class TestGetExpressRouteCircuitAuthorization < 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_get_express_route_circuit_authorization_success
12
+ mocked_response = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
13
+ @circuit_authorization.stub :get, mocked_response do
14
+ assert_equal @service.get_express_route_circuit_authorization('Fog-rg', 'testCircuit', 'auth-name'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_express_route_circuit_authorization_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @circuit_authorization.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_express_route_circuit_authorization('Fog-rg', 'testCircuit', 'auth-name') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Load Balancer Request
4
+ class TestGetLoadBalancer < Minitest::Test
5
+ def setup
6
+ @service = Fog::Network::AzureRM.new(credentials)
7
+ @network_client = @service.instance_variable_get(:@network_client)
8
+ @load_balancers = @network_client.load_balancers
9
+ end
10
+
11
+ def test_get_load_balancer_success
12
+ mocked_response = ApiStub::Requests::Network::LoadBalancer.create_load_balancer_response(@network_client)
13
+ @load_balancers.stub :get, mocked_response do
14
+ assert_equal @service.get_load_balancer('fog-test-rg', 'mylb1'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_load_balancer_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @load_balancers.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_load_balancer('fog-test-rg', 'mylb1') }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Test class for Get Local Network Gateway Request
4
+ class TestGetLocalNetworkGateway < 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_get_local_network_gateway_success
12
+ mocked_response = ApiStub::Requests::Network::LocalNetworkGateway.create_local_network_gateway_response(@network_client)
13
+ @local_network_gateways.stub :get, mocked_response do
14
+ assert_equal @service.get_local_network_gateway('fog-test-rg', 'fog-test-local-network-gateway'), mocked_response
15
+ end
16
+ end
17
+
18
+ def test_get_local_network_gateway_failure
19
+ response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
20
+ @local_network_gateways.stub :get, response do
21
+ assert_raises(RuntimeError) { @service.get_local_network_gateway('fog-test-rg', 'fog-test-local-network-gateway') }
22
+ end
23
+ end
24
+ end