Sha256: 18be22d627a15e081b85029a889b3af3d8bf0ce237e6edec9e305c9c30961869

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

require 'test_plugin_helper'

class ConfigNameServiceTest < ActiveSupport::TestCase
  setup do
    @name_service = ForemanOpenscap::ConfigNameService.new
  end

  test 'should find config for Puppet' do
    assert @name_service.config_for(:puppet).is_a?(ForemanOpenscap::ClientConfig::Puppet)
  end

  test 'should find config for Ansible' do
    assert @name_service.config_for(:ansible).is_a?(ForemanOpenscap::ClientConfig::Ansible)
  end

  test 'should find config for Manual' do
    assert @name_service.config_for(:manual).is_a?(ForemanOpenscap::ClientConfig::Manual)
  end

  test 'should find all except Manual' do
    configs = @name_service.all_except(:manual)
    assert_equal 2, configs.size
    refute configs.map(&:type).include?(:manual)
  end

  test 'should find all available except Manual' do
    skip unless puppet_available?
    ForemanOpenscap::ClientConfig::Ansible.any_instance.stubs(:available?).returns(false)
    configs = @name_service.all_available_except(:manual)
    assert_equal 1, configs.size
    assert_equal :puppet, configs.first.type
  end

  test 'should find all available with overrides except Puppet' do
    ForemanOpenscap::ClientConfig::Ansible.any_instance.stubs(:available?).returns(true)
    configs = @name_service.all_available_with_overrides_except(:puppet)
    assert_equal 1, configs.size
    assert_equal :ansible, configs.first.type
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
foreman_openscap-10.0.3 test/unit/services/config_name_service_test.rb
foreman_openscap-10.0.2 test/unit/services/config_name_service_test.rb
foreman_openscap-10.0.1 test/unit/services/config_name_service_test.rb
foreman_openscap-10.0.0 test/unit/services/config_name_service_test.rb
foreman_openscap-9.0.4 test/unit/services/config_name_service_test.rb
foreman_openscap-9.0.3 test/unit/services/config_name_service_test.rb
foreman_openscap-9.0.2 test/unit/services/config_name_service_test.rb
foreman_openscap-9.0.1 test/unit/services/config_name_service_test.rb
foreman_openscap-9.0.0 test/unit/services/config_name_service_test.rb
foreman_openscap-8.0.0 test/unit/services/config_name_service_test.rb
foreman_openscap-7.1.1 test/unit/services/config_name_service_test.rb
foreman_openscap-7.1.0 test/unit/services/config_name_service_test.rb
foreman_openscap-7.0.0 test/unit/services/config_name_service_test.rb
foreman_openscap-6.0.0 test/unit/services/config_name_service_test.rb
foreman_openscap-5.2.3 test/unit/services/config_name_service_test.rb
foreman_openscap-5.2.2 test/unit/services/config_name_service_test.rb
foreman_openscap-5.1.1 test/unit/services/config_name_service_test.rb
foreman_openscap-5.2.1 test/unit/services/config_name_service_test.rb
foreman_openscap-5.2.0 test/unit/services/config_name_service_test.rb
foreman_openscap-5.1.0 test/unit/services/config_name_service_test.rb