Sha256: 710c62f22f9593553725fa2ce5b4c57a081e7ef2e2c413453f0527e02312a53f

Contents?: true

Size: 1.33 KB

Versions: 16

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe 'Puppet::Type::Group::Provider::Aix' do
  let(:provider_class) { Puppet::Type.type(:group).provider(:aix) }

  let(:resource) do
    Puppet::Type.type(:group).new(
      :name   => 'test_aix_user',
      :ensure => :present
    )
  end
  let(:provider) do
    provider_class.new(resource)
  end

  describe '.find' do
    let(:groups) do
      objects = [
        { :name => 'group1', :id => '1' },
        { :name => 'group2', :id => '2' }
      ]

      objects
    end

    let(:ia_module_args) { [ '-R', 'module' ] }

    let(:expected_group) do
      {
        :name => 'group1',
        :gid  => 1
      }
    end

    before(:each) do
      provider_class.stubs(:list_all).with(ia_module_args).returns(groups)
    end

    it 'raises an ArgumentError if the group does not exist' do
      expect do
        provider_class.find('non_existent_group', ia_module_args)
      end.to raise_error do |error|
        expect(error).to be_a(ArgumentError)

        expect(error.message).to match('non_existent_group')
      end
    end

    it 'can find the group when passed-in a group name' do
      expect(provider_class.find('group1', ia_module_args)).to eql(expected_group)
    end

    it 'can find the group when passed-in the gid' do
      expect(provider_class.find(1, ia_module_args)).to eql(expected_group)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-6.0.3 spec/unit/provider/group/aix_spec.rb
puppet-6.0.3-x86-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.3-x64-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.3-universal-darwin spec/unit/provider/group/aix_spec.rb
puppet-5.5.7 spec/unit/provider/group/aix_spec.rb
puppet-5.5.7-x86-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-5.5.7-x64-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-5.5.7-universal-darwin spec/unit/provider/group/aix_spec.rb
puppet-6.0.2 spec/unit/provider/group/aix_spec.rb
puppet-6.0.2-x86-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.2-x64-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.2-universal-darwin spec/unit/provider/group/aix_spec.rb
puppet-6.0.1 spec/unit/provider/group/aix_spec.rb
puppet-6.0.1-x86-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.1-x64-mingw32 spec/unit/provider/group/aix_spec.rb
puppet-6.0.1-universal-darwin spec/unit/provider/group/aix_spec.rb