Sha256: 8e4fbf8a374a0331a0d551ca8b3c65720964de2d65537474eaf4d5ae7dc0929a

Contents?: true

Size: 1.36 KB

Versions: 14

Compression:

Stored size: 1.36 KB

Contents

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

# Test Class for Update Public IP Request
class TestUpdatePublicIp < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    network_client = @service.instance_variable_get(:@network_client)
    @public_ips = network_client.public_ipaddresses
    @response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(network_client)
    @tags = { key: 'value' }
  end

  def test_update_public_ip_success
    @public_ips.stub :create_or_update, @response do
      assert_equal @service.create_or_update_public_ip('TestRG', 'testPubIp432', 'West US', 'Dynamic', '4', 'mylabel', @tags), @response
    end
  end

  def test_update_public_ip_argument_error_failure
    @public_ips.stub :create_or_update, @response do
      assert_raises ArgumentError do
        @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US')
      end
    end
  end

  def test_update_public_ip_exception_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @public_ips.stub :create_or_update, response do
      assert_raises MsRestAzure::AzureOperationError do
        @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '4', 'mylabel', @tags)
      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_update_public_ip.rb
fog-azure-rm-0.5.3 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.5.2 test/requests/network/test_update_public_ip.rb
far-gem-0.5.6 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.5.1 test/requests/network/test_update_public_ip.rb
far-gem-0.5.5 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.5.0 test/requests/network/test_update_public_ip.rb
far-gem-0.5.4 test/requests/network/test_update_public_ip.rb
far-gem-0.5.3 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.4.9 test/requests/network/test_update_public_ip.rb
far-gem-0.5.2 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.4.8 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.4.7 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.4.6 test/requests/network/test_update_public_ip.rb