Sha256: 0a9cef4876871ff78790177fd3e2f6adf5e9c53c56078804b4510288a0e5535b

Contents?: true

Size: 1.2 KB

Versions: 26

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanLeapp
  class TemplateHelperTest < ActionView::TestCase
    let(:host) { FactoryBot.create(:host) }
    let(:report) { FactoryBot.create(:preupgrade_report, host: host) }
    let(:entry) { FactoryBot.create(:preupgrade_report_entry, host: host, preupgrade_report: report) }

    describe 'build_remediation_plan' do
      test 'with remediation commands' do
        template = build_remediation_plan([entry.id], host)
        assert_equal template, "yum -y remove leapp_pkg\n"
      end

      test 'without remediation commands' do
        empty_entry = FactoryBot.create(:preupgrade_report_entry, host: host, preupgrade_report: report,
                                                                  detail: { remediations: [{ type: 'hint',
                                                                                             context: 'meh.' }] })
        template = build_remediation_plan([empty_entry.id], host)
        assert_equal template, ''
      end

      test 'only for current host' do
        template = build_remediation_plan([entry.id], FactoryBot.create(:host))
        assert_equal template, ''
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foreman_leapp-0.1.0 test/helpers/template_helper_test.rb
foreman_leapp-0.0.6 test/helpers/template_helper_test.rb
foreman_leapp-0.0.5 test/helpers/template_helper_test.rb
foreman_leapp-0.0.4 test/helpers/template_helper_test.rb
foreman_leapp-0.0.3 test/helpers/template_helper_test.rb
foreman_leapp-0.0.2 test/helpers/template_helper_test.rb