Sha256: 769bde7379c2911e8d324faf1d91dbf8119cf1d4ec2db4343bb71b0d73fe5e61

Contents?: true

Size: 903 Bytes

Versions: 7

Compression:

Stored size: 903 Bytes

Contents

require 'test_plugin_helper'

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

  setup do
    response = mock('respone')
    response.stubs(:body).returns('TEST PLAYBOOK')
    ForemanRhCloud::RemediationsRetriever.any_instance.stubs(:query_playbook).returns(response)
    @host1 = FactoryBot.create(:host)
    Setting[:rh_cloud_token] = 'MOCK_TOKEN'
  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

7 entries across 7 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.35 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.34 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.33 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.32 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.31 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.30 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb
foreman_rh_cloud-5.0.29 test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb