Sha256: 494de782c5973fad31a5289a2df5535c081feab2c8fe581fcf97cf9212e4c76e

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 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 MsRestAzure::AzureOperationError do
        @service.create_or_update_virtual_network_gateway_connection(network_gateway_parms)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
fog-azure-rm-0.6.0 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.5.3 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.5.2 test/requests/network/test_create_virtual_network_gateway_connection.rb
far-gem-0.5.6 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.5.1 test/requests/network/test_create_virtual_network_gateway_connection.rb
far-gem-0.5.5 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.5.0 test/requests/network/test_create_virtual_network_gateway_connection.rb
far-gem-0.5.4 test/requests/network/test_create_virtual_network_gateway_connection.rb
far-gem-0.5.3 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.4.9 test/requests/network/test_create_virtual_network_gateway_connection.rb
far-gem-0.5.2 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.4.8 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.4.7 test/requests/network/test_create_virtual_network_gateway_connection.rb
fog-azure-rm-0.4.6 test/requests/network/test_create_virtual_network_gateway_connection.rb