Sha256: 23edc753a310d1ba4ddafae6b20960e838adbb9a327214547806ed0d2a4e493c

Contents?: true

Size: 1.64 KB

Versions: 33

Compression:

Stored size: 1.64 KB

Contents

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

# Test class for Create Virtual Network Gateway Connection Request
class TestCreateVirtualNetworkGatewayConnection < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @gateway_connections = @network_client.virtual_network_gateway_connections
    @connection_response = ApiStub::Requests::Network::VirtualNetworkGatewayConnection.create_virtual_network_gateway_connection_response(@network_client)
  end

  def test_create_virtual_network_gateway_connection_success
    network_gateway_parms = { name: 'temp', resource_group_name: 'Test' }
    @gateway_connections.stub :create_or_update, @connection_response do
      assert_equal @service.create_or_update_virtual_network_gateway_connection(network_gateway_parms), @connection_response
    end
  end

  def test_create_virtual_network_gateway_connection_argument_error_failure
    @gateway_connections.stub :create_or_update, @connection_response do
      assert_raises ArgumentError do
        @service.create_or_update_virtual_network_gateway_connection
      end
    end
  end

  def test_create_virtual_network_gateway_connection_exception_failure
    network_gateway_parms = { name: 'temp', resource_group_name: 'Test' }
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @gateway_connections.stub :create_or_update, response do
      assert_raises RuntimeError do
        @service.create_or_update_virtual_network_gateway_connection(network_gateway_parms)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
fog-azure-rm-downgraded-0.3.1 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.3.1 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-downgraded-0.3.0 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.3.0 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.7 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.6 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.5 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.4 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.3 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.2 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.1 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.2.0 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.1.2 test/requests/network/test_create_virtual_network_gateway_connection.rb