Sha256: c812677935556765f2a8dc3adb0093a54ae51d72580b71a96e8d84e48c8d0e06

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

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

# Test class for Create Public IP Request
class TestCreatePublicIp < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @public_ips = @network_client.public_ipaddresses
    @tags = { key: 'value' }
  end

  def test_create_public_ip_success
    mocked_response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(@network_client)
    @public_ips.stub :create_or_update, mocked_response do
      assert_equal @service.create_or_update_public_ip('fog-test-rg', 'fog-test-public-ip', 'West US', 'Dynamic', '', '', @tags), mocked_response
    end
  end

  def test_create_public_ip_argument_error_failure
    mocked_response = ApiStub::Requests::Network::PublicIp.create_public_ip_response(@network_client)
    @public_ips.stub :create_or_update, mocked_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_create_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', '', '', @tags)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.5 test/requests/network/test_create_public_ip.rb
fog-azure-rm-temp-0.0.5 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.4.4 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.4.3 test/requests/network/test_create_public_ip.rb
far-gem-0.5.1 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.4.2 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.4.1 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.4.0 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.9 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.8 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.7 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.6 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.5 test/requests/network/test_create_public_ip.rb
fog-azure-rm-0.3.4 test/requests/network/test_create_public_ip.rb