Sha256: 89d0b78a519c55661be5e49d7e2d234a87ad57f96bd3103d24addf1e613f00fc

Contents?: true

Size: 1.19 KB

Versions: 234

Compression:

Stored size: 1.19 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

provider_class = Puppet::Type.type(:selboolean).provider(:getsetsebool)

describe provider_class do
  before :each do
    @resource = stub("resource", :name => "foo")
    @resource.stubs(:[]).returns "foo"
    @provider = provider_class.new(@resource)
  end

  it "should return :on when getsebool returns on" do
    @provider.expects(:getsebool).with("foo").returns "foo --> on\n"
    expect(@provider.value).to eq(:on)
  end

  it "should return :off when getsebool returns on" do
    @provider.expects(:getsebool).with("foo").returns "foo --> off\n"
    expect(@provider.value).to eq(:off)
  end

  it "should call execpipe when updating boolean setting" do
    @provider.expects(:command).with(:setsebool).returns "/usr/sbin/setsebool"
    @provider.expects(:execpipe).with("/usr/sbin/setsebool  foo off")
    @provider.value = :off
  end

  it "should call execpipe with -P when updating persistent boolean setting" do
    @resource.stubs(:[]).with(:persistent).returns :true
    @provider.expects(:command).with(:setsebool).returns "/usr/sbin/setsebool"
    @provider.expects(:execpipe).with("/usr/sbin/setsebool -P foo off")
    @provider.value = :off
  end

end

Version data entries

234 entries across 234 versions & 1 rubygems

Version Path
puppet-5.5.12 spec/unit/provider/selboolean_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.12-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.10 spec/unit/provider/selboolean_spec.rb
puppet-5.5.10-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.10-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.10-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.8 spec/unit/provider/selboolean_spec.rb
puppet-5.5.8-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.8-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.8-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.7 spec/unit/provider/selboolean_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.7-universal-darwin spec/unit/provider/selboolean_spec.rb
puppet-5.5.6 spec/unit/provider/selboolean_spec.rb
puppet-5.5.6-x86-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.6-x64-mingw32 spec/unit/provider/selboolean_spec.rb
puppet-5.5.6-universal-darwin spec/unit/provider/selboolean_spec.rb