Sha256: e88a42fe239e8ac542bc9a7f48d23c52dc26c45a176cfd762b7220f278132897

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_leapp-2.0.3 test/helpers/template_helper_test.rb
foreman_leapp-2.0.2 test/helpers/template_helper_test.rb
foreman_leapp-2.0.1 test/helpers/template_helper_test.rb
foreman_leapp-2.0.0 test/helpers/template_helper_test.rb