Sha256: 7221f8ba093b5af7433b0dda5faeb0abafeba20027a3a2975531ce597fedfcf7

Contents?: true

Size: 1004 Bytes

Versions: 6

Compression:

Stored size: 1004 Bytes

Contents

require 'test_plugin_helper'

class TemplateRendererHelperTest < ActiveSupport::TestCase
  include ForemanRhCloud::TemplateRendererHelper
  include MockCerts

  setup do
    response = mock('respone')
    response.stubs(:body).returns('TEST PLAYBOOK')
    ForemanRhCloud::RemediationsRetriever.any_instance.stubs(:query_playbook).returns(response)
    @host1 = FactoryBot.create(:host)

    setup_certs_expectation do
      ForemanRhCloud::RemediationsRetriever.any_instance.stubs(:candlepin_id_cert)
    end
  end

  test 'Generates a playbook for hit and remediation' do
    rule = FactoryBot.create(:insights_rule)
    hit = FactoryBot.create(:insights_hit, rule: rule, host_id: @host1.id)
    remediation = FactoryBot.create(:insights_resolution, rule: rule)

    pairs = [{ hit_id: hit.id, remediation_id: remediation.id }].to_json

    actual_playbook = remediations_playbook(pairs)

    assert_equal 'TEST PLAYBOOK', actual_playbook
  end

  def template_logger
    Logger.new(IO::NULL)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_rh_cloud-10.0.3 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-11.0.3 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-11.0.2 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-11.0.1 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-11.0.0 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-10.0.2 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb