Sha256: 93d4365de2e91c0b29a53b45331c69895a7710c8b3f674211f08d982f2beac04

Contents?: true

Size: 1.65 KB

Versions: 17

Compression:

Stored size: 1.65 KB

Contents

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

17 entries across 17 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.13 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.12 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.11 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.10 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.9 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.8 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.7 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.6 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.5 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.4 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.3 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.2 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.1 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.2.0 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.1.2 test/unit/services/insights_plan_runner_test.rb
foreman_ansible-2.1.1 test/unit/services/insights_plan_runner_test.rb