Sha256: 2aabe2afacc4c3691e7ebcea5593cf34f441728f263af5ae02bb08fb0f0344df

Contents?: true

Size: 1.69 KB

Versions: 19

Compression:

Stored size: 1.69 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
    ]
    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

19 entries across 19 versions & 3 rubygems

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