Sha256: 35b15922f1ee577d5921639a98b990ae3dc1de2629c6b202ecebfbca19b6b933

Contents?: true

Size: 1.21 KB

Versions: 69

Compression:

Stored size: 1.21 KB

Contents

require 'test_plugin_helper'

class TailoringFilesProxyCheckTest < ActiveSupport::TestCase
  test 'should find proxies with old versions' do
    ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
                                              .returns('old-proxy.test.com' => "0.5.4", "outdate-proxy.test.com" => "0.6.0")
    check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
    refute check.pass?
    refute check.message.empty?
  end

  test 'should not find any outdated proxies' do
    ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:openscap_proxy_versions)
                                              .returns({})
    check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
    assert check.pass?
    assert check.message.empty?
  end

  test 'should fail when proxy cannot be reached' do
    ProxyStatus::Version.any_instance.stubs(:version).raises(Foreman::WrappedException.new(nil, 'test message'))
    ForemanOpenscap::OpenscapProxyVersionCheck.any_instance.stubs(:get_openscap_proxies).returns([FactoryBot.create(:openscap_proxy)])
    check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
    refute check.pass?
    refute check.message.empty?
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
foreman_openscap-9.0.2 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-9.0.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-9.0.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-8.0.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-7.1.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-7.1.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-7.0.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-6.0.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.2.3 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.2.2 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.1.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.2.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.2.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.1.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-5.0.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-4.3.3 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-4.3.2 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-4.3.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-4.3.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-4.1.3 test/unit/services/tailoring_files_proxy_check_test.rb