Sha256: b6822bc4171c50ae25f5afbba10f3fb5b658c8942bec7339cb0d3e096b83c066

Contents?: true

Size: 1014 Bytes

Versions: 5

Compression:

Stored size: 1014 Bytes

Contents

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

# Test class for Set Connection Shared Key Request
class TestResetConnectionSharedKey < 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
  end

  def test_reset_connection_shared_key_success
    @gateway_connections.stub :reset_shared_key, nil do
      assert_equal @service.reset_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', '20'), true
    end
  end

  def test_reset_connection_shared_key_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @gateway_connections.stub :reset_shared_key, response do
      assert_raises(RuntimeError) { @service.reset_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', '20') }
    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_reset_connection_shared_key.rb
fog-azure-rm-0.1.0 test/requests/network/test_reset_connection_shared_key.rb
fog-azure-rm-0.0.9 test/requests/network/test_reset_connection_shared_key.rb
fog-azure-rm-0.0.8 test/requests/network/test_reset_connection_shared_key.rb
fog-azure-rm-0.0.6 test/requests/network/test_reset_connection_shared_key.rb