Sha256: 7ff92aa86305e7ac7d1e72a7465bd508184a8bbad582c1a92b8ab3b43685602a

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 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)
  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'), @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 RuntimeError do
        @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '4', 'mylabel')
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 test/requests/network/test_update_public_ip.rb
fog-azure-rm-temp-0.0.3 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.3.3 test/requests/network/test_update_public_ip.rb
fog-azure-rm-temp-0.0.2 test/requests/network/test_update_public_ip.rb
fog-azure-rm-temp-0.0.1 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.3.2 test/requests/network/test_update_public_ip.rb
fog-azure-rm-downgraded-0.3.1 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.3.1 test/requests/network/test_update_public_ip.rb
fog-azure-rm-downgraded-0.3.0 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.3.0 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.7 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.6 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.5 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.4 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.3 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.2 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.1 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.2.0 test/requests/network/test_update_public_ip.rb
fog-azure-rm-0.1.2 test/requests/network/test_update_public_ip.rb