Sha256: f760b932130e8b803ee6ce1a6b1c913edfa30fca916d2f8318a6de2fd3913190

Contents?: true

Size: 1006 Bytes

Versions: 5

Compression:

Stored size: 1006 Bytes

Contents

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

# Test class for Set Connection Shared Key Request
class TestSetConnectionSharedKey < 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_set_connection_shared_key_success
    @gateway_connections.stub :set_shared_key, nil do
      assert_equal @service.set_connection_shared_key('fog-test-rg', 'fog-test-gateway-connection', 'hello'), true
    end
  end

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