Sha256: 3933254738b21d681f3e6a9eb5a6386b9b24a6409185d9b2e92cd1ce716fe39b

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

#
# Author:: Matt Wrock (<matt@mattwrock.com>)
# Copyright:: Copyright (c) 2016-2018 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "spec_helper"
require "openssl"

describe Ohai::System, "plugin fips" do
  let(:enabled) { 0 }
  let(:plugin) { get_plugin("windows/fips") }
  let(:openssl_test_mode) { false }

  subject do
    plugin.run
    plugin["fips"]["kernel"]["enabled"]
  end

  before(:each) do
    allow(plugin).to receive(:collect_os).and_return(:windows)
  end

  around do |ex|

    $FIPS_TEST_MODE = openssl_test_mode
    ex.run
  ensure
    $FIPS_TEST_MODE = false

  end

  context "with OpenSSL.fips_mode == false" do
    before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
    it "does not set fips plugin" do
      expect(subject).to be(false)
    end
  end

  context "with OpenSSL.fips_mode == true" do
    before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
    it "sets fips plugin" do
      expect(subject).to be(true)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ohai-15.2.5 spec/unit/plugins/windows/fips_spec.rb
ohai-15.1.5 spec/unit/plugins/windows/fips_spec.rb
ohai-15.1.3 spec/unit/plugins/windows/fips_spec.rb
ohai-15.0.35 spec/unit/plugins/windows/fips_spec.rb