Sha256: 40c87f945dfb38bd130354b050c4b854201a95c23d804acadec2d4eb3b153398

Contents?: true

Size: 1.21 KB

Versions: 16

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([FactoryGirl.create(:openscap_proxy)])
    check = ForemanOpenscap::OpenscapProxyVersionCheck.new.run
    refute check.pass?
    refute check.message.empty?
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_openscap-0.7.13 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.12 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.11 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.10 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.8.3 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.9 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.8 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.7 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.8.2 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.6 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.8.1 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.5 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.8.0 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.4 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.3 test/unit/services/tailoring_files_proxy_check_test.rb
foreman_openscap-0.7.2 test/unit/services/tailoring_files_proxy_check_test.rb