Sha256: f42259af4397f5a1a5be0a14f1e09adb133fe32a7579914a790565dde75ab308
Contents?: true
Size: 1.9 KB
Versions: 3
Compression:
Stored size: 1.9 KB
Contents
require File.expand_path '../../test_helper', __dir__ # Test class for VirtualNetwork Collection class TestVirtualNetworks < Minitest::Test def setup @service = Fog::Network::AzureRM.new(credentials) @virtual_networks = Fog::Network::AzureRM::VirtualNetworks.new(resource_group: 'fog-test-rg', service: @service) @network_client = @service.instance_variable_get(:@network_client) end def test_collection_methods methods = [ :all, :get, :check_if_exists ] methods.each do |method| assert_respond_to @virtual_networks, method end end def test_collection_attributes assert_respond_to @virtual_networks, :resource_group end def test_all_method_response response = [ApiStub::Models::Network::VirtualNetwork.create_virtual_network_response(@network_client)] @service.stub :list_virtual_networks, response do assert_instance_of Fog::Network::AzureRM::VirtualNetworks, @virtual_networks.all assert @virtual_networks.all.size >= 1 @virtual_networks.all.each do |nic| assert_instance_of Fog::Network::AzureRM::VirtualNetwork, nic end end end def test_get_method_response response = ApiStub::Models::Network::VirtualNetwork.create_virtual_network_response(@network_client) @service.stub :get_virtual_network, response do assert_instance_of Fog::Network::AzureRM::VirtualNetwork, @virtual_networks.get('fog-rg', 'fog-test-virtual-network') end end def test_check_if_exists_method_success @service.stub :check_for_virtual_network, true do assert @virtual_networks.check_if_exists('fog-test-rg', 'fog-test-virtual-network') end end def test_check_if_exists_method_failure @service.stub :check_for_virtual_network, false do assert !@virtual_networks.check_if_exists('fog-test-rg', 'fog-test-virtual-network') end end end
Version data entries
3 entries across 3 versions & 1 rubygems