Sha256: ee7ac6da1aa94eff16e60404a61b5915063d5161e5964235a14d2928d6ed5273

Contents?: true

Size: 1.85 KB

Versions: 14

Compression:

Stored size: 1.85 KB

Contents

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

# Test class for Create Express Route Circuit Peering Request
class TestCreateExpressRouteCircuitPeering < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @circuit_peerings = @network_client.express_route_circuit_peerings
  end

  def test_create_express_route_circuit_peering_success
    circuit_peering_parameters = { peering_type: 'AzurePrivatePeering' }
    mocked_response = ApiStub::Requests::Network::ExpressRouteCircuitPeering.create_express_route_circuit_peering_response(@network_client)
    @circuit_peerings.stub :create_or_update, mocked_response do
      assert_equal @service.create_or_update_express_route_circuit_peering(circuit_peering_parameters), mocked_response
    end
  end

  def test_create_express_route_circuit_argument_error_failure
    response = ApiStub::Requests::Network::ExpressRouteCircuitPeering.create_express_route_circuit_peering_response(@network_client)
    @circuit_peerings.stub :create_or_update, response do
      assert_raises ArgumentError do
        @service.create_or_update_express_route_circuit_peering('Fog-rg', 'AzurePrivatePeering', 'testCircuit', 'AzurePrivatePeering', 100, '192.168.1.0/30', '"192.168.2.0/30"', 'NotConfigured', '200', 'routing_registry_name')
      end
    end
  end

  def test_create_express_route_circuit_exception_failure
    circuit_peering_parameters = { peering_type: 'AzurePrivatePeering' }
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @circuit_peerings.stub :create_or_update, response do
      assert_raises MsRestAzure::AzureOperationError do
        @service.create_or_update_express_route_circuit_peering(circuit_peering_parameters)
      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_express_route_circuit_peering.rb
fog-azure-rm-0.5.3 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.5.2 test/requests/network/test_create_express_route_circuit_peering.rb
far-gem-0.5.6 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.5.1 test/requests/network/test_create_express_route_circuit_peering.rb
far-gem-0.5.5 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.5.0 test/requests/network/test_create_express_route_circuit_peering.rb
far-gem-0.5.4 test/requests/network/test_create_express_route_circuit_peering.rb
far-gem-0.5.3 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.4.9 test/requests/network/test_create_express_route_circuit_peering.rb
far-gem-0.5.2 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.4.8 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.4.7 test/requests/network/test_create_express_route_circuit_peering.rb
fog-azure-rm-0.4.6 test/requests/network/test_create_express_route_circuit_peering.rb