Sha256: 573cd81a2f15d1279738e910366c1b7f2786265c126d3552d6ead0d59087b659

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for VirtualNetworkGatewayConnection Collection
class TestVirtualNetworkGatewayConnections < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @gateway_connections = Fog::Network::AzureRM::VirtualNetworkGatewayConnections.new(resource_group: 'fog-rg', service: @service)
    @network_client = @service.instance_variable_get(:@network_client)
    @response = ApiStub::Models::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get
    ]
    methods.each do |method|
      assert @gateway_connections.respond_to? method
    end
  end

  def test_collection_attributes
    assert @gateway_connections.respond_to? :resource_group
  end

  def test_all_method_response
    connection_response = [@response]
    @service.stub :list_virtual_network_gateway_connections, connection_response do
      assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnections, @gateway_connections.all
      assert @gateway_connections.all.size >= 1
      @gateway_connections.all.each do |gateway_connection|
        assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, gateway_connection
      end
    end
  end

  def test_get_method_response
    @service.stub :get_virtual_network_gateway_connection, @response do
      assert_instance_of Fog::Network::AzureRM::VirtualNetworkGatewayConnection, @gateway_connections.get('fog-rg', 'cn1')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/network/test_virtual_network_gateway_connections.rb
fog-azure-rm-0.0.6 test/models/network/test_virtual_network_gateway_connections.rb