fog-azure-rm 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/README.md +0 -1
- data/fog-azure-rm.gemspec +4 -1
- data/lib/fog/azurerm.rb +7 -0
- data/lib/fog/azurerm/application_gateway.rb +10 -2
- data/lib/fog/azurerm/compute.rb +14 -4
- data/lib/fog/azurerm/config.rb +0 -51
- data/lib/fog/azurerm/constants.rb +51 -0
- data/lib/fog/azurerm/dns.rb +12 -4
- data/lib/fog/azurerm/docs/application_gateway.md +38 -4
- data/lib/fog/azurerm/docs/compute.md +23 -4
- data/lib/fog/azurerm/docs/dns.md +18 -4
- data/lib/fog/azurerm/docs/key_vault.md +88 -0
- data/lib/fog/azurerm/docs/network.md +98 -9
- data/lib/fog/azurerm/docs/resources.md +24 -4
- data/lib/fog/azurerm/docs/sql.md +5 -6
- data/lib/fog/azurerm/docs/storage.md +12 -0
- data/lib/fog/azurerm/docs/traffic_manager.md +22 -4
- data/lib/fog/azurerm/key_vault.rb +51 -0
- data/lib/fog/azurerm/models/application_gateway/backend_address_pool.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/backend_http_setting.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_ip_configuration.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/frontend_port.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +2 -6
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -0
- data/lib/fog/azurerm/models/application_gateway/http_listener.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +3 -0
- data/lib/fog/azurerm/models/application_gateway/probe.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/request_routing_rule.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/ssl_certificate.rb +2 -0
- data/lib/fog/azurerm/models/application_gateway/url_path_map.rb +2 -0
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -0
- data/lib/fog/azurerm/models/compute/servers.rb +4 -0
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +4 -0
- data/lib/fog/azurerm/models/dns/record_sets.rb +4 -0
- data/lib/fog/azurerm/models/dns/zones.rb +2 -2
- data/lib/fog/azurerm/models/key_vault/access_policy_entry.rb +31 -0
- data/lib/fog/azurerm/models/key_vault/vault.rb +76 -0
- data/lib/fog/azurerm/models/key_vault/vaults.rb +27 -0
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -0
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +12 -2
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -0
- data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -0
- data/lib/fog/azurerm/models/network/public_ips.rb +2 -9
- data/lib/fog/azurerm/models/network/subnets.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -0
- data/lib/fog/azurerm/models/network/virtual_networks.rb +9 -11
- data/lib/fog/azurerm/models/resources/azure_resources.rb +4 -0
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -0
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -0
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +5 -17
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_database.rb +4 -21
- data/lib/fog/azurerm/models/sql/sql_databases.rb +4 -0
- data/lib/fog/azurerm/models/sql/sql_server.rb +5 -18
- data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -0
- data/lib/fog/azurerm/models/storage/directories.rb +4 -0
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -0
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -0
- data/lib/fog/azurerm/network.rb +22 -4
- data/lib/fog/azurerm/requests/application_gateway/check_ag_exists.rb +31 -0
- data/lib/fog/azurerm/requests/application_gateway/create_or_update_application_gateway.rb +6 -0
- data/lib/fog/azurerm/requests/compute/check_availability_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_exists.rb +31 -0
- data/lib/fog/azurerm/requests/compute/check_vm_extension_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/check_record_set_exists.rb +31 -0
- data/lib/fog/azurerm/requests/dns/{check_for_zone.rb → check_zone_exists.rb} +4 -2
- data/lib/fog/azurerm/requests/dns/list_record_sets.rb +1 -1
- data/lib/fog/azurerm/requests/dns/list_zones.rb +2 -2
- data/lib/fog/azurerm/requests/key_vault/check_vault_exists.rb +31 -0
- data/lib/fog/azurerm/requests/key_vault/create_or_update_vault.rb +105 -0
- data/lib/fog/azurerm/requests/key_vault/delete_vault.rb +28 -0
- data/lib/fog/azurerm/requests/key_vault/get_vault.rb +54 -0
- data/lib/fog/azurerm/requests/key_vault/list_vaults.rb +56 -0
- data/lib/fog/azurerm/requests/network/check_express_route_cir_auth_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_express_route_circuit_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_load_balancer_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_local_net_gateway_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_group_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_net_sec_rule_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/check_network_interface_exists.rb +31 -0
- data/lib/fog/azurerm/requests/network/{check_for_public_ip.rb → check_public_ip_exists.rb} +12 -5
- data/lib/fog/azurerm/requests/network/check_subnet_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/{check_for_virtual_network.rb → check_virtual_network_exists.rb} +11 -6
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_connection_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/check_vnet_gateway_exists.rb +32 -0
- data/lib/fog/azurerm/requests/network/list_load_balancers_in_subscription.rb +31 -0
- data/lib/fog/azurerm/requests/network/list_virtual_networks_in_subscription.rb +74 -0
- data/lib/fog/azurerm/requests/resources/check_azure_resource_exists.rb +40 -0
- data/lib/fog/azurerm/requests/resources/check_deployment_exists.rb +30 -0
- data/lib/fog/azurerm/requests/resources/check_resource_group_exists.rb +30 -0
- data/lib/fog/azurerm/requests/sql/check_database_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_firewall_rule_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/check_sql_server_exists.rb +21 -0
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +26 -32
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +8 -22
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +14 -24
- data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +2 -9
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +3 -9
- data/lib/fog/azurerm/requests/sql/get_database.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +4 -10
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -10
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +4 -10
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -10
- data/lib/fog/azurerm/requests/storage/check_container_exists.rb +30 -0
- data/lib/fog/azurerm/requests/storage/check_storage_account_exists.rb +31 -0
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/delete_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/disable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/enable_backup_protection.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +1 -1
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +1 -1
- data/lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb +1 -1
- data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_endpoint_exists.rb +31 -0
- data/lib/fog/azurerm/requests/traffic_manager/check_traffic_manager_profile_exists.rb +31 -0
- data/lib/fog/azurerm/resources.rb +10 -2
- data/lib/fog/azurerm/sql.rb +18 -10
- data/lib/fog/azurerm/storage.rb +4 -0
- data/lib/fog/azurerm/traffic_manager.rb +9 -2
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +3 -10
- data/test/api_stub.rb +8 -0
- data/test/api_stub/models/key_vault/vault.rb +39 -0
- data/test/api_stub/models/sql/sql_database.rb +18 -16
- data/test/api_stub/models/sql/sql_firewall_rule.rb +12 -10
- data/test/api_stub/models/sql/sql_server.rb +12 -10
- data/test/api_stub/requests/key_vault/vault.rb +95 -0
- data/test/api_stub/requests/sql/database.rb +8 -6
- data/test/api_stub/requests/sql/firewall_rule.rb +8 -4
- data/test/api_stub/requests/sql/sql_server.rb +8 -4
- data/test/integration/Virtual_network_gateway_connection.rb +7 -0
- data/test/integration/application_gateway.rb +8 -0
- data/test/integration/availability_set.rb +13 -2
- data/test/integration/blob.rb +0 -6
- data/test/integration/container.rb +7 -0
- data/test/integration/deployment.rb +7 -0
- data/test/integration/express_route_circuit.rb +16 -0
- data/test/integration/external_load_balancer.rb +18 -0
- data/test/integration/key_vault.rb +98 -0
- data/test/integration/local_network_gateway.rb +8 -0
- data/test/integration/network_interface.rb +8 -0
- data/test/integration/network_security_group.rb +8 -0
- data/test/integration/network_security_rule.rb +8 -0
- data/test/integration/public_ip.rb +3 -2
- data/test/integration/record_set.rb +8 -0
- data/test/integration/resource_group.rb +12 -4
- data/test/integration/resource_tag.rb +7 -0
- data/test/integration/server.rb +8 -0
- data/test/integration/sql_server.rb +23 -3
- data/test/integration/storage_account.rb +8 -1
- data/test/integration/subnet.rb +7 -0
- data/test/integration/traffic_manager.rb +14 -0
- data/test/integration/virtual_machine_extension.rb +8 -0
- data/test/integration/virtual_network.rb +13 -4
- data/test/integration/virtual_network_gateway.rb +7 -0
- data/test/integration/zone.rb +8 -0
- data/test/models/application_gateway/test_gateway.rb +1 -0
- data/test/models/application_gateway/test_gateways.rb +14 -1
- data/test/models/compute/test_availability_sets.rb +14 -1
- data/test/models/compute/test_servers.rb +14 -1
- data/test/models/compute/test_virtual_machine_extensions.rb +14 -1
- data/test/models/dns/test_record_sets.rb +14 -1
- data/test/models/dns/test_zones.rb +7 -7
- data/test/models/key_vault/test_vault.rb +39 -0
- data/test/models/key_vault/test_vaults.rb +55 -0
- data/test/models/network/test_express_route_circuit_authorizations.rb +14 -1
- data/test/models/network/test_express_route_circuits.rb +14 -1
- data/test/models/network/test_load_balancers.rb +14 -1
- data/test/models/network/test_local_network_gateways.rb +14 -1
- data/test/models/network/test_network_interfaces.rb +14 -1
- data/test/models/network/test_network_security_groups.rb +14 -1
- data/test/models/network/test_network_security_rules.rb +14 -1
- data/test/models/network/test_public_ips.rb +6 -6
- data/test/models/network/test_subnets.rb +14 -1
- data/test/models/network/test_virtual_network_gateway_connections.rb +14 -1
- data/test/models/network/test_virtual_network_gateways.rb +14 -1
- data/test/models/network/test_virtual_networks.rb +20 -8
- data/test/models/resources/test_deployments.rb +14 -1
- data/test/models/resources/test_resource_groups.rb +14 -1
- data/test/models/resources/test_resources.rb +16 -3
- data/test/models/sql/test_database.rb +3 -4
- data/test/models/sql/test_databases.rb +5 -5
- data/test/models/sql/test_firewall_rule.rb +2 -1
- data/test/models/sql/test_firewall_rules.rb +3 -2
- data/test/models/sql/test_sql_server.rb +2 -1
- data/test/models/sql/test_sql_servers.rb +5 -5
- data/test/models/storage/test_directories.rb +14 -1
- data/test/models/storage/test_storage_accounts.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_end_points.rb +14 -1
- data/test/models/traffic_manager/test_traffic_manager_profiles.rb +14 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +31 -0
- data/test/requests/compute/test_check_availability_set_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_exists.rb +31 -0
- data/test/requests/compute/test_check_vm_extension_exists.rb +31 -0
- data/test/requests/dns/test_check_record_set_exists.rb +31 -0
- data/test/requests/dns/test_check_zone_exists.rb +35 -0
- data/test/requests/dns/test_list_record_sets.rb +35 -0
- data/test/requests/dns/{test_check_for_zone.rb → test_list_zones.rb} +10 -8
- data/test/requests/key_vault/test_check_vault_exists.rb +31 -0
- data/test/requests/key_vault/test_create_or_update_vault.rb +25 -0
- data/test/requests/key_vault/test_delete_vault.rb +23 -0
- data/test/requests/key_vault/test_get_vault.rb +24 -0
- data/test/requests/key_vault/test_list_vaults.rb +24 -0
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +31 -0
- data/test/requests/network/test_check_express_route_circuit_exists.rb +31 -0
- data/test/requests/network/test_check_load_balancer_exists.rb +31 -0
- data/test/requests/network/test_check_local_net_gateway_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_group_exists.rb +31 -0
- data/test/requests/network/test_check_net_sec_rule_exists.rb +31 -0
- data/test/requests/network/test_check_network_interface_exists.rb +31 -0
- data/test/requests/network/{test_check_for_public_ip.rb → test_check_public_ip_exists.rb} +8 -8
- data/test/requests/network/test_check_subnet_exists.rb +31 -0
- data/test/requests/network/{test_check_for_virtual_network.rb → test_check_virtual_network_exists.rb} +8 -8
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +31 -0
- data/test/requests/network/test_check_vnet_gateway_exists.rb +31 -0
- data/test/requests/network/test_list_virtual_networks_in_subscription.rb +24 -0
- data/test/requests/resources/test_check_azure_resource_exists.rb +22 -0
- data/test/requests/resources/test_check_deployment_exists.rb +29 -0
- data/test/requests/resources/test_check_resource_group_exists.rb +29 -0
- data/test/requests/sql/test_create_or_update_database.rb +9 -12
- data/test/requests/sql/test_create_or_update_firewall_rule.rb +9 -11
- data/test/requests/sql/test_create_or_update_sql_server.rb +9 -12
- data/test/requests/sql/test_delete_database.rb +6 -17
- data/test/requests/sql/test_delete_firewall_rule.rb +6 -17
- data/test/requests/sql/test_delete_sql_server.rb +6 -17
- data/test/requests/sql/test_get_database.rb +7 -18
- data/test/requests/sql/test_get_firewall_rule.rb +7 -18
- data/test/requests/sql/test_get_sql_server.rb +7 -18
- data/test/requests/sql/test_list_databases.rb +7 -18
- data/test/requests/sql/test_list_firewall_rules.rb +7 -18
- data/test/requests/sql/test_list_sql_servers.rb +7 -18
- data/test/requests/storage/test_check_container_exists.rb +18 -0
- data/test/requests/storage/test_check_storage_account_exists.rb +32 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +31 -0
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +31 -0
- data/test/test_helper.rb +39 -4
- metadata +125 -10
@@ -11,7 +11,8 @@ class TestVirtualMachineExtensions < Minitest::Test
|
|
11
11
|
def test_collection_methods
|
12
12
|
methods = [
|
13
13
|
:all,
|
14
|
-
:get
|
14
|
+
:get,
|
15
|
+
:check_vm_extension_exists
|
15
16
|
]
|
16
17
|
methods.each do |method|
|
17
18
|
assert_respond_to @vm_extensions, method
|
@@ -33,4 +34,16 @@ class TestVirtualMachineExtensions < Minitest::Test
|
|
33
34
|
assert_instance_of Fog::Compute::AzureRM::VirtualMachineExtension, @vm_extensions.get('fog-test-rg', 'fog-test-server', 'fog-test-extension')
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
def test_check_vm_extension_exists_true_case
|
39
|
+
@service.stub :check_vm_extension_exists, true do
|
40
|
+
assert @vm_extensions.check_vm_extension_exists('fog-test-rg', 'fog-test-server', 'fog-test-extension')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_check_vm_extension_exists_false_case
|
45
|
+
@service.stub :check_vm_extension_exists, false do
|
46
|
+
assert !@vm_extensions.check_vm_extension_exists('fog-test-rg', 'fog-test-server', 'fog-test-extension')
|
47
|
+
end
|
48
|
+
end
|
36
49
|
end
|
@@ -12,7 +12,8 @@ class TestRecordSets < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_record_set_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @record_sets, method
|
@@ -50,4 +51,16 @@ class TestRecordSets < Minitest::Test
|
|
50
51
|
assert_instance_of Fog::DNS::AzureRM::RecordSet, @record_sets.get('fog-test-rg', 'fog-test-record-set', 'fog-test-zone', 'A')
|
51
52
|
end
|
52
53
|
end
|
54
|
+
|
55
|
+
def test_check_record_set_exists_true_case
|
56
|
+
@service.stub :check_record_set_exists, true do
|
57
|
+
assert @record_sets.check_record_set_exists('fog-test-rg', 'fog-test-record-set', 'fog-test-zone', 'A')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_check_record_set_exists_false_case
|
62
|
+
@service.stub :check_record_set_exists, false do
|
63
|
+
assert !@record_sets.check_record_set_exists('fog-test-rg', 'fog-test-record-set', 'fog-test-zone', 'A')
|
64
|
+
end
|
65
|
+
end
|
53
66
|
end
|
@@ -13,7 +13,7 @@ class TestZones < Minitest::Test
|
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
15
|
:get,
|
16
|
-
:
|
16
|
+
:check_zone_exists
|
17
17
|
]
|
18
18
|
methods.each do |method|
|
19
19
|
assert_respond_to @zones, method
|
@@ -37,15 +37,15 @@ class TestZones < Minitest::Test
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
@service.stub :
|
42
|
-
assert @zones.
|
40
|
+
def test_check_zone_exists_true_response
|
41
|
+
@service.stub :check_zone_exists, true do
|
42
|
+
assert @zones.check_zone_exists('fog-test-rg', 'fog-test-zone.com')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
@service.stub :
|
48
|
-
assert
|
46
|
+
def test_check_zone_exists_false_response
|
47
|
+
@service.stub :check_zone_exists, true do
|
48
|
+
assert @zones.check_zone_exists('fog-test-rg', 'fog-test-zone.com')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Vault Model
|
4
|
+
class TestVault < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
@vault = Fog::KeyVault::AzureRM::Vault.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_model_attributes
|
11
|
+
attributes = [
|
12
|
+
:name,
|
13
|
+
:id,
|
14
|
+
:resource_group,
|
15
|
+
:location,
|
16
|
+
:vault_uri,
|
17
|
+
:tenant_id,
|
18
|
+
:sku_family,
|
19
|
+
:sku_name,
|
20
|
+
:access_policies,
|
21
|
+
:enabled_for_deployment,
|
22
|
+
:enabled_for_disk_encryption,
|
23
|
+
:enabled_for_template_deployment
|
24
|
+
]
|
25
|
+
attributes.each do |attribute|
|
26
|
+
assert_respond_to @vault, attribute
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_model_methods
|
31
|
+
methods = [
|
32
|
+
:save,
|
33
|
+
:destroy
|
34
|
+
]
|
35
|
+
methods.each do |method|
|
36
|
+
assert_respond_to @vault, method
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
2
|
+
|
3
|
+
# Test class for Vaults Collection
|
4
|
+
class TestVaults < Minitest::Test
|
5
|
+
def setup
|
6
|
+
@service = Fog::KeyVault::AzureRM.new(credentials)
|
7
|
+
@key_vault_client = @service.instance_variable_get(:@key_vault_client)
|
8
|
+
@vaults = Fog::KeyVault::AzureRM::Vaults.new(resource_group: 'fog-test-rg', service: @service)
|
9
|
+
@response = ApiStub::Models::KeyVault::Vault.create_vault_response(@key_vault_client)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_collection_methods
|
13
|
+
methods = [
|
14
|
+
:all,
|
15
|
+
:get,
|
16
|
+
:check_vault_exists
|
17
|
+
]
|
18
|
+
methods.each do |method|
|
19
|
+
assert_respond_to @vaults, method
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_collection_attributes
|
24
|
+
assert_respond_to @vaults, :resource_group
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_all_method_response
|
28
|
+
response = [@response]
|
29
|
+
@service.stub :list_vaults, response do
|
30
|
+
assert_instance_of Fog::KeyVault::AzureRM::Vaults, @vaults.all
|
31
|
+
assert @vaults.all.size >= 1
|
32
|
+
@vaults.all.each do |vault|
|
33
|
+
assert_instance_of Fog::KeyVault::AzureRM::Vault, vault
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_get_method_response
|
39
|
+
@service.stub :get_vault, @response do
|
40
|
+
assert_instance_of Fog::KeyVault::AzureRM::Vault, @vaults.get('fog-test-rg', 'fog-test-kv')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_check_vault_exists_true_response
|
45
|
+
@service.stub :check_vault_exists, true do
|
46
|
+
assert @vaults.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_vault_exists_false_response
|
51
|
+
@service.stub :check_vault_exists, false do
|
52
|
+
assert !@vaults.check_vault_exists('fog-test-rg', 'fog-test-kv')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -11,7 +11,8 @@ class TestExpressRouteCircuitAuthorizations < Minitest::Test
|
|
11
11
|
def test_collection_methods
|
12
12
|
methods = [
|
13
13
|
:all,
|
14
|
-
:get
|
14
|
+
:get,
|
15
|
+
:check_express_route_cir_auth_exists
|
15
16
|
]
|
16
17
|
methods.each do |method|
|
17
18
|
assert_respond_to @circuit_authorizations, method
|
@@ -40,4 +41,16 @@ class TestExpressRouteCircuitAuthorizations < Minitest::Test
|
|
40
41
|
assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuitAuthorization, @circuit_authorizations.get('HaiderRG', 'testCircuit', 'auth-name')
|
41
42
|
end
|
42
43
|
end
|
44
|
+
|
45
|
+
def test_check_express_route_cir_auth_exists_true_response
|
46
|
+
@service.stub :check_express_route_cir_auth_exists, true do
|
47
|
+
assert @circuit_authorizations.check_express_route_cir_auth_exists('HaiderRG', 'testCircuit', 'auth-name')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_check_express_route_cir_auth_exists_false_response
|
52
|
+
@service.stub :check_express_route_cir_auth_exists, false do
|
53
|
+
assert !@circuit_authorizations.check_express_route_cir_auth_exists('HaiderRG', 'testCircuit', 'auth-name')
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
@@ -11,7 +11,8 @@ class TestExpressRouteCircuits < Minitest::Test
|
|
11
11
|
def test_collection_methods
|
12
12
|
methods = [
|
13
13
|
:all,
|
14
|
-
:get
|
14
|
+
:get,
|
15
|
+
:check_express_route_circuit_exists
|
15
16
|
]
|
16
17
|
methods.each do |method|
|
17
18
|
assert_respond_to @circuits, method
|
@@ -39,4 +40,16 @@ class TestExpressRouteCircuits < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuit, @circuits.get('HaiderRG', 'testCircuit')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_express_route_circuit_exists_true_response
|
45
|
+
@service.stub :check_express_route_circuit_exists, true do
|
46
|
+
assert @circuits.check_express_route_circuit_exists('HaiderRG', 'testCircuit')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_express_route_circuit_exists_false_response
|
51
|
+
@service.stub :check_express_route_circuit_exists, false do
|
52
|
+
assert !@circuits.check_express_route_circuit_exists('HaiderRG', 'testCircuit')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
@@ -12,7 +12,8 @@ class TestLoadBalancers < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_load_balancer_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @load_balancers, method
|
@@ -39,4 +40,16 @@ class TestLoadBalancers < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancers.get('fog-test-rg', 'mylb1')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_load_balancer_exists_true_response
|
45
|
+
@service.stub :check_load_balancer_exists, true do
|
46
|
+
assert @load_balancers.check_load_balancer_exists('fog-test-rg', 'mylb1')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_load_balancer_exists_false_response
|
51
|
+
@service.stub :check_load_balancer_exists, false do
|
52
|
+
assert !@load_balancers.check_load_balancer_exists('fog-test-rg', 'mylb1')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
@@ -12,7 +12,8 @@ class TestLocalNetworkGateways < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_local_net_gateway_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @local_network_gateways, method
|
@@ -39,4 +40,16 @@ class TestLocalNetworkGateways < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::LocalNetworkGateway, @local_network_gateways.get('fog-rg', 'mylocalgateway1')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_local_net_gateway_exists_true_response
|
45
|
+
@service.stub :check_local_net_gateway_exists, true do
|
46
|
+
assert @local_network_gateways.check_local_net_gateway_exists('fog-rg', 'mylocalgateway1')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_local_net_gateway_exists_false_response
|
51
|
+
@service.stub :check_local_net_gateway_exists, false do
|
52
|
+
assert !@local_network_gateways.check_local_net_gateway_exists('fog-rg', 'mylocalgateway1')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
@@ -11,7 +11,8 @@ class TestNetworkInterfaces < Minitest::Test
|
|
11
11
|
def test_collection_methods
|
12
12
|
methods = [
|
13
13
|
:all,
|
14
|
-
:get
|
14
|
+
:get,
|
15
|
+
:check_network_interface_exists
|
15
16
|
]
|
16
17
|
methods.each do |method|
|
17
18
|
assert_respond_to @network_interfaces, method
|
@@ -39,4 +40,16 @@ class TestNetworkInterfaces < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::NetworkInterface, @network_interfaces.get('fog-test-rg', 'fog-test-network-interface')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_network_interface_exists_true_response
|
45
|
+
@service.stub :check_network_interface_exists, true do
|
46
|
+
assert @network_interfaces.check_network_interface_exists('fog-test-rg', 'fog-test-network-interface')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_network_interface_exists_false_response
|
51
|
+
@service.stub :check_network_interface_exists, false do
|
52
|
+
assert !@network_interfaces.check_network_interface_exists('fog-test-rg', 'fog-test-network-interface')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
@@ -12,7 +12,8 @@ class TestNetworkSecurityGroups < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_net_sec_group_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @network_security_groups, method
|
@@ -38,4 +39,16 @@ class TestNetworkSecurityGroups < Minitest::Test
|
|
38
39
|
assert_instance_of Fog::Network::AzureRM::NetworkSecurityGroup, @network_security_groups.get('fog-test-rg', 'fog-test-nsg')
|
39
40
|
end
|
40
41
|
end
|
42
|
+
|
43
|
+
def test_check_net_sec_group_exists_true_response
|
44
|
+
@service.stub :check_net_sec_group_exists, true do
|
45
|
+
assert @network_security_groups.check_net_sec_group_exists('fog-test-rg', 'fog-test-nsg')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_check_net_sec_group_exists_false_response
|
50
|
+
@service.stub :check_net_sec_group_exists, false do
|
51
|
+
assert !@network_security_groups.check_net_sec_group_exists('fog-test-rg', 'fog-test-nsg')
|
52
|
+
end
|
53
|
+
end
|
41
54
|
end
|
@@ -12,7 +12,8 @@ class TestNetworkSecurityRules < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_net_sec_rule_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @network_security_rules, method
|
@@ -39,4 +40,16 @@ class TestNetworkSecurityRules < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::NetworkSecurityRule, @network_security_rules.get('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_net_sec_rule_exists_true_response
|
45
|
+
@service.stub :check_net_sec_rule_exists, true do
|
46
|
+
assert @network_security_rules.check_net_sec_rule_exists('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_net_sec_rule_exists_false_response
|
51
|
+
@service.stub :check_net_sec_rule_exists, false do
|
52
|
+
assert !@network_security_rules.check_net_sec_rule_exists('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
@@ -13,7 +13,7 @@ class TestPublicIps < Minitest::Test
|
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
15
|
:get,
|
16
|
-
:
|
16
|
+
:check_public_ip_exists
|
17
17
|
]
|
18
18
|
methods.each do |method|
|
19
19
|
assert_respond_to @public_ips, method
|
@@ -41,15 +41,15 @@ class TestPublicIps < Minitest::Test
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
@service.stub :
|
46
|
-
assert @public_ips.
|
44
|
+
def test_check_public_ip_exists_method_success
|
45
|
+
@service.stub :check_public_ip_exists, true do
|
46
|
+
assert @public_ips.check_public_ip_exists('fog-test-rg', 'fog-test-public-ip')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_check_if_exists_method_failure
|
51
|
-
@service.stub :
|
52
|
-
assert !@public_ips.
|
51
|
+
@service.stub :check_public_ip_exists, false do
|
52
|
+
assert !@public_ips.check_public_ip_exists('fog-test-rg', 'fog-test-public-ip')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -11,7 +11,8 @@ class TestSubnets < Minitest::Test
|
|
11
11
|
def test_collection_methods
|
12
12
|
methods = [
|
13
13
|
:all,
|
14
|
-
:get
|
14
|
+
:get,
|
15
|
+
:check_subnet_exists
|
15
16
|
]
|
16
17
|
methods.each do |method|
|
17
18
|
assert_respond_to @subnets, method
|
@@ -40,4 +41,16 @@ class TestSubnets < Minitest::Test
|
|
40
41
|
assert_instance_of Fog::Network::AzureRM::Subnet, @subnets.get('fog-test-rg', 'fog-test-vnet', 'fog-test-subnet')
|
41
42
|
end
|
42
43
|
end
|
44
|
+
|
45
|
+
def test_check_subnet_exists_true_response
|
46
|
+
@service.stub :check_subnet_exists, true do
|
47
|
+
assert @subnets.check_subnet_exists('fog-test-rg', 'fog-test-vnet', 'fog-test-subnet')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_check_subnet_exists_false_response
|
52
|
+
@service.stub :check_subnet_exists, false do
|
53
|
+
assert !@subnets.check_subnet_exists('fog-test-rg', 'fog-test-vnet', 'fog-test-subnet')
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
@@ -12,7 +12,8 @@ class TestVirtualNetworkGatewayConnections < Minitest::Test
|
|
12
12
|
def test_collection_methods
|
13
13
|
methods = [
|
14
14
|
:all,
|
15
|
-
:get
|
15
|
+
:get,
|
16
|
+
:check_vnet_gateway_connection_exists
|
16
17
|
]
|
17
18
|
methods.each do |method|
|
18
19
|
assert_respond_to @gateway_connections, method
|
@@ -39,4 +40,16 @@ class TestVirtualNetworkGatewayConnections < Minitest::Test
|
|
39
40
|
assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, @gateway_connections.get('fog-rg', 'cn1')
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
def test_check_vnet_gateway_connection_exists_true_response
|
45
|
+
@service.stub :check_vnet_gateway_connection_exists, true do
|
46
|
+
assert @gateway_connections.check_vnet_gateway_connection_exists('fog-rg', 'cn1')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_check_vnet_gateway_connection_exists_false_response
|
51
|
+
@service.stub :check_vnet_gateway_connection_exists, false do
|
52
|
+
assert !@gateway_connections.check_vnet_gateway_connection_exists('fog-rg', 'cn1')
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|