Sha256: 67e10bc94f0eb33a2d7deb060c99035e4f6356f3ed51023c63941c4bb2356d5c

Contents?: true

Size: 977 Bytes

Versions: 46

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanAnsible
  # Test for the structured facts importer - its code mostly lives in Foreman
  # core, so only details have to be tested here.
  class StructuredFactImporterTest < ActiveSupport::TestCase
    test 'if host is not in Foreman, use hostname provided by call' do
      fake_host = Host.new(:name => 'fake')
      importer = ForemanAnsible::StructuredFactImporter.new(
        fake_host,
        facts_json
      )
      assert_equal fake_host, importer.send(:host)
    end

    test 'if host is in Foreman, use hostname provided by Ansible' do
      ansible_fqdn_host = FactoryBot.build(:host)
      ansible_fqdn_host.name = facts_json[:ansible_facts][:ansible_fqdn]
      ansible_fqdn_host.save
      importer = ForemanAnsible::StructuredFactImporter.new(
        Host.new(:name => 'fake'),
        facts_json
      )

      assert_equal ansible_fqdn_host, importer.send(:host)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
foreman_ansible-6.3.4 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.3.3 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.3.2 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.3.1 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.4.1 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.4.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.3.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.2.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.1.1 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.0.2 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.1.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.0.1 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-5.1.3 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-6.0.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-5.1.2 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-5.1.1 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-5.1.0 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-4.0.3.5 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-4.0.3.4 test/unit/services/structured_fact_importer_test.rb
foreman_ansible-4.0.3.3 test/unit/services/structured_fact_importer_test.rb