Sha256: 3f4b0a581ea95a7a467393e8606fc6b6746b82779ae583dfa2272fde648f3bb9

Contents?: true

Size: 772 Bytes

Versions: 13

Compression:

Stored size: 772 Bytes

Contents

require 'test_plugin_helper'
# Unit tests for AnsibleReportImporter
# This class is just meant to capture the config reports coming
# from Ansible and change anything that is required
class AnsibleReportImporterTest < ActiveSupport::TestCase
  setup do
    @raw = { 'host' => '192.168.121.1' }
    @importer = ::ConfigReportImporter.new(@raw)
  end

  test 'finds host when the hostname is given as the IP' do
    host = ::FactoryBot.create(:host, :ip => @raw['host'])
    ForemanAnsible::AnsibleReportScanner.expects(:ansible_report?).returns(true)
    assert_equal @importer.host, host
  end

  test 'creates new host if IP is not found' do
    ForemanAnsible::AnsibleReportScanner.expects(:ansible_report?).returns(true)
    assert @importer.host.new_record?
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.13 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.12 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.11 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.10 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.9 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.8 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.7 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.6 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.5 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.4 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.3 test/unit/services/ansible_report_importer_test.rb
foreman_ansible-2.2.2 test/unit/services/ansible_report_importer_test.rb