Sha256: ce99a65d458bd46cad69bfa8200c7384c552a120ac491fa74f7584db65f0a73c

Contents?: true

Size: 1.68 KB

Versions: 96

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

if defined? RedhatAccess
  module ForemanAnsible
    # Tests for the RH Insights plan runner. Mostly about checking whether
    # the playbook can be parsed properly
    class InsightsPlanRunnerTest < ActiveSupport::TestCase
      test 'disclaimer is saved as raw_playbook' do
        disclaimer = <<-DISCLAIMER.strip_heredoc.strip
  # Red Hat Insights has recommended one or more actions for you, a system administrator, to review and if you
  # deem appropriate, deploy on your systems running Red Hat software. Based on the analysis, we have automatically
  # generated an Ansible Playbook for you. Please review and test the recommended actions and the Playbook as
  # they may contain configuration changes, updates, reboots and/or other changes to your systems. Red Hat is not
  # responsible for any adverse outcomes related to these recommendations or Playbooks.
  #
  # Addresses maintenance plan 38439429 (demo)
  # https://access.redhat.com/insights/planner/438294928
  # Generated by Red Hat Insights on Wed, 18 Apr 2018 07:54:18 GMT
        DISCLAIMER

        playbook = File.read(ansible_fixture_file('insights_playbook.yaml'))
        planner = ::ForemanAnsible::InsightsPlanRunner.new(
          FactoryBot.build(:organization), rand
        )
        assert_empty planner.parse_disclaimer
        planner.expects(:insights_api_host).returns('')
        planner.expects(:get_ssl_options_for_org).returns(nil)
        RestClient::Resource.any_instance.expects(:get).returns(
          OpenStruct.new(:body => playbook)
        )
        planner.playbook
        assert_equal disclaimer, planner.parse_disclaimer
      end
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
foreman_ansible-3.0.8 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.7 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.6 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.5 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.4 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.3 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.6 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.5 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.4 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.2 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.1 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-3.0.0 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.3 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.2 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.1 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.3.0 test/unit/services/insights_plan_runner_test.rb