Sha256: 8303ea14b4a9943d9042e7a23c7ac7cfe5e1941077a67eb89838f458fd9e1bc7

Contents?: true

Size: 1.7 KB

Versions: 28

Compression:

Stored size: 1.7 KB

Contents

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

# Test class for PublicIp Model
class TestPublicIp < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @public_ip = public_ip(@service)
  end

  def test_model_methods
    methods = [
      :save,
      :destroy,
      :update
    ]
    methods.each do |method|
      assert_respond_to @public_ip, method
    end
  end

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :location,
      :resource_group,
      :ip_address,
      :public_ip_allocation_method,
      :idle_timeout_in_minutes,
      :ip_configuration_id,
      :domain_name_label,
      :fqdn,
      :reverse_fqdn,
      :tags
    ]
    attributes.each do |attribute|
      assert_respond_to @public_ip, attribute
    end
  end

  def test_save_method_response
    response = ApiStub::Models::Network::PublicIp.create_public_ip_response(@network_client)
    @service.stub :create_or_update_public_ip, response do
      assert_instance_of Fog::Network::AzureRM::PublicIp, @public_ip.save
    end
  end

  def test_update_method_response
    response = ApiStub::Models::Network::PublicIp.create_public_ip_response(@network_client)
    @service.stub :create_or_update_public_ip, response do
      assert_instance_of Fog::Network::AzureRM::PublicIp, @public_ip.update({})
    end
  end

  def test_destroy_method_response
    response = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
    @service.stub :delete_public_ip, response do
      assert_instance_of MsRestAzure::AzureOperationResponse, @public_ip.destroy
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
fog-azure-rm-0.6.0 test/models/network/test_public_ip.rb
fog-azure-rm-0.5.3 test/models/network/test_public_ip.rb
fog-azure-rm-0.5.2 test/models/network/test_public_ip.rb
far-gem-0.5.6 test/models/network/test_public_ip.rb
fog-azure-rm-0.5.1 test/models/network/test_public_ip.rb
far-gem-0.5.5 test/models/network/test_public_ip.rb
fog-azure-rm-0.5.0 test/models/network/test_public_ip.rb
far-gem-0.5.4 test/models/network/test_public_ip.rb
far-gem-0.5.3 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.9 test/models/network/test_public_ip.rb
far-gem-0.5.2 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.8 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.7 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.6 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.5 test/models/network/test_public_ip.rb
fog-azure-rm-temp-0.0.5 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.4 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.3 test/models/network/test_public_ip.rb
far-gem-0.5.1 test/models/network/test_public_ip.rb
fog-azure-rm-0.4.2 test/models/network/test_public_ip.rb