Sha256: 079f43003b031ddac1af289eb3d5f04ecd9d29738a52875477b15055faa1693f

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

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

# Test class for Create Express Route Circuit Authorization Request
class TestCreateExpressRouteCircuitAuthorization < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @circuit_authorizations = @network_client.express_route_circuit_authorizations
    @auth_params = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.auth_hash
    @mocked_response = ApiStub::Requests::Network::ExpressRouteCircuitAuthorization.create_express_route_circuit_authorization_response(@network_client)
  end

  def test_create_express_route_circuit_authorization_success
    @circuit_authorizations.stub :create_or_update, @mocked_response do
      assert_equal @service.create_or_update_express_route_circuit_authorization(@auth_params), @mocked_response
    end
  end

  def test_create_express_route_circuit_authorization_argument_error_failure
    @circuit_authorizations.stub :create_or_update, @mocked_response do
      assert_raises ArgumentError do
        @service.create_or_update_express_route_circuit_authorization('test-resource-group', 'circuit-name')
      end
    end
  end

  def test_create_express_route_circuit_authorization_exception_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @circuit_authorizations.stub :create_or_update, response do
      assert_raises RuntimeError do
        @service.create_or_update_express_route_circuit_authorization(@auth_params)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/network/test_create_express_route_circuit_authorization.rb
fog-azure-rm-0.1.0 test/requests/network/test_create_express_route_circuit_authorization.rb
fog-azure-rm-0.0.9 test/requests/network/test_create_express_route_circuit_authorization.rb
fog-azure-rm-0.0.8 test/requests/network/test_create_express_route_circuit_authorization.rb
fog-azure-rm-0.0.6 test/requests/network/test_create_express_route_circuit_authorization.rb