Sha256: eb03eb00695b5fd0949572575cb1727c446c09fd2483b1447f24cf4ab6fe4f25

Contents?: true

Size: 727 Bytes

Versions: 15

Compression:

Stored size: 727 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
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.36 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-3.0.33 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.35 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-3.0.32 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.32 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.31 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-5.0.31 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-5.0.30 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.30 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-3.0.29 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.29 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-5.0.29 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-3.0.28 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-5.0.28 test/unit/foreman_rh_cloud_self_host_test.rb
foreman_rh_cloud-4.0.27 test/unit/foreman_rh_cloud_self_host_test.rb