Sha256: 43b92275042ace6df3772c4fdf51e055605694e8340afb4e3a9823a1cf9e2da8

Contents?: true

Size: 1.77 KB

Versions: 39

Compression:

Stored size: 1.77 KB

Contents

#!/usr/bin/env ruby
require 'spec_helper'
require 'puppet/util/windows'

describe "Puppet::Util::Windows::AccessControlEntry", :if => Puppet.features.microsoft_windows? do
  let(:klass) { Puppet::Util::Windows::AccessControlEntry }
  let(:sid) { 'S-1-5-18' }
  let(:mask) { Puppet::Util::Windows::File::FILE_ALL_ACCESS }

  it "creates an access allowed ace" do
    ace = klass.new(sid, mask)

    ace.type.should == klass::ACCESS_ALLOWED_ACE_TYPE
  end

  it "creates an access denied ace" do
    ace = klass.new(sid, mask, 0, klass::ACCESS_DENIED_ACE_TYPE)

    ace.type.should == klass::ACCESS_DENIED_ACE_TYPE
  end

  it "creates a non-inherited ace by default" do
    ace = klass.new(sid, mask)

    ace.should_not be_inherited
  end

  it "creates an inherited ace" do
    ace = klass.new(sid, mask, klass::INHERITED_ACE)

    ace.should be_inherited
  end

  it "creates a non-inherit-only ace by default" do
    ace = klass.new(sid, mask)

    ace.should_not be_inherit_only
  end

  it "creates an inherit-only ace" do
    ace = klass.new(sid, mask, klass::INHERIT_ONLY_ACE)

    ace.should be_inherit_only
  end

  context "when comparing aces" do
    let(:ace1) { klass.new(sid, mask, klass::INHERIT_ONLY_ACE, klass::ACCESS_DENIED_ACE_TYPE) }
    let(:ace2) { klass.new(sid, mask, klass::INHERIT_ONLY_ACE, klass::ACCESS_DENIED_ACE_TYPE) }

    it "returns true if different objects have the same set of values" do
    ace1.should == ace2
    end

    it "returns false if different objects have different sets of values" do
      ace = klass.new(sid, mask)
      ace.should_not == ace1
    end

    it "returns true when testing if two objects are eql?" do
      ace1.eql?(ace2)
    end

    it "returns false when comparing object identity" do
      ace1.should_not be_equal(ace2)
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.6 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.5 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.4 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.3 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.2 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.1 spec/unit/util/windows/access_control_entry_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/util/windows/access_control_entry_spec.rb