Sha256: 5ac9810aa1cec83430a52056cb71dab151706238880f300641f517082bce8bc1

Contents?: true

Size: 929 Bytes

Versions: 47

Compression:

Stored size: 929 Bytes

Contents

require 'test_plugin_helper'

class ForemanRhCloudSelfHostTest < ActiveSupport::TestCase
  setup do
    # reset cached value
    ForemanRhCloud.instance_variable_set(:@foreman_host, nil)
  end

  test 'finds host by fullname' do
    @domain
    @host = FactoryBot.create(:host, :managed)
    ForemanRhCloud.expects(:foreman_host_name).returns(@host.name)

    actual = ForemanRhCloud.foreman_host

    assert_not_nil actual
  end

  test 'finds host by shortname' do
    @host = FactoryBot.create(:host, :managed)
    Host.where(name: @host.name).update_all(name: @host.shortname)
    ForemanRhCloud.expects(:foreman_host_name).returns(@host.name)

    actual = ForemanRhCloud.foreman_host

    assert_not_nil actual
  end

  test 'finds host by infrastructure facet' do
    @host = FactoryBot.create(:host, :managed, :with_infrastructure_facet)
    actual = ForemanRhCloud.foreman_host

    assert_equal @host, actual
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
foreman_rh_cloud-10.0.3 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-11.0.3 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.59 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-11.0.2 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-11.0.1 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-11.0.0 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.58 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-10.0.2 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.57 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-10.0.1 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.56 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.55 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.54 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.53 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.52 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-8.0.52 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-9.0.51 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-8.0.51 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-7.0.48 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-7.0.47 test/unit/foreman_rh_cloud_self_host_test.rb