Sha256: 461cc1418f3accb26afd2cb2e79d848649098cf7df04083e4abc386d5bd3b456

Contents?: true

Size: 1.83 KB

Versions: 14

Compression:

Stored size: 1.83 KB

Contents

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

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

  def test_create_express_route_circuit_success
    mocked_response = ApiStub::Requests::Network::ExpressRouteCircuit.create_express_route_circuit_response(@network_client)
    peerings = ApiStub::Requests::Network::ExpressRouteCircuit.peerings
    express_route_circuit_parameters = { peerings: peerings }
    @circuit.stub :create_or_update, mocked_response do
      assert_equal @service.create_or_update_express_route_circuit(express_route_circuit_parameters), mocked_response
    end
  end

  def test_create_express_route_circuit_argument_error_failure
    response = ApiStub::Requests::Network::ExpressRouteCircuit.create_express_route_circuit_response(@network_client)
    @circuit.stub :create_or_update, response do
      assert_raises ArgumentError do
        @service.create_or_update_express_route_circuit('Fog-rg', 'testCircuit', 'eastus', 'value1', 'value2', 'Standard_MeteredData', 'Standard', 'MeteredData', 'Telenor', 'London', 100)
      end
    end
  end

  def test_create_express_route_circuit_exception_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    peerings = ApiStub::Requests::Network::ExpressRouteCircuit.peerings
    express_route_circuit_parameters = { peerings: peerings }
    @circuit.stub :create_or_update, response do
      assert_raises MsRestAzure::AzureOperationError do
        @service.create_or_update_express_route_circuit(express_route_circuit_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.rb
fog-azure-rm-0.5.3 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.5.2 test/requests/network/test_create_express_route_circuit.rb
far-gem-0.5.6 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.5.1 test/requests/network/test_create_express_route_circuit.rb
far-gem-0.5.5 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.5.0 test/requests/network/test_create_express_route_circuit.rb
far-gem-0.5.4 test/requests/network/test_create_express_route_circuit.rb
far-gem-0.5.3 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.4.9 test/requests/network/test_create_express_route_circuit.rb
far-gem-0.5.2 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.4.8 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.4.7 test/requests/network/test_create_express_route_circuit.rb
fog-azure-rm-0.4.6 test/requests/network/test_create_express_route_circuit.rb