Skip to content

Commit

Permalink
modified unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Bode committed Oct 11, 2010
1 parent befb480 commit 350a018
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 255 deletions.
7 changes: 7 additions & 0 deletions spec/lib/helpers.rb
Expand Up @@ -103,3 +103,10 @@ def fixture(name, ext = '.txt')
end

end
#Spec::Example::ExampleGroupFactory.register(:provider, ProviderExampleGroup)
#
# Outside wrapper to lookup a provider and start the spec using ProviderExampleGroup
#def describe_provider(type_name, provider_name, options = {}, &block)
# provider_class = Puppet::Type.type(type_name).provider(provider_name)
# describe(provider_class, options.merge(:type => :provider), &block)
#end
72 changes: 72 additions & 0 deletions spec/unit/provider/sudoers/parsed_spec.rb
@@ -0,0 +1,72 @@
require 'pathname'; Pathname.new(__FILE__).realpath.ascend { |x| begin; require (x + 'spec_helper.rb'); break; rescue LoadError; end }

#describe_provider :sudoers, :parsed, :resource => {:path => '/tmp/vcsrepo'} do
describe Puppet::Type.type(:sudoers).provider(:parsed) do
before(:each) do
@provider = Puppet::Type.type(:sudoers).provider(:parsed)
end
it 'should not be null' do
@provider.should_not be_nil
end

describe 'setup' do
it 'should fail if visudo is not in path' do
ENV['PATH']=''
@provider = Puppet::Type.type(:sudoers).provider(:parsed)
end
it 'should work if visudo is in path' do
end
end

# context "parsing lines" do
# context "should ignore empty lines" do
#
# end
# context "should ignore comment lines" do
#
# end
# context "parsing invalid lines" do
#
# end
# context "parsing alias lines" do
#
# end
# context "parsing user spec lines" do
# context "prefetch comment NAMEVAR lines for user spec"
# end
# end
# context "parsing defaults lines" do
#
# end
# end
#
# context "dissallow type changes" do
# # not sure if this requires a type
# end
#
#
# context "Writing lines" do
# context "write comment lines" do
#
# end
# context "write blank lines" do
#
# end
# context "write user alias lines" do
#
# end
# context "write user spec lines" do
#
# end
# context "write defaults lines" do
#
# end
# context "fail for invalid types" do
#
# end
# context "fail for invalid lines" do
#
# end
# end
end

55 changes: 0 additions & 55 deletions spec/unit/provider/sudoers/sudoers.spec

This file was deleted.

40 changes: 0 additions & 40 deletions spec/unit/puppet/provider/ec2/ec2.rb

This file was deleted.

125 changes: 0 additions & 125 deletions spec/unit/puppet/type/ec2.rb

This file was deleted.

34 changes: 0 additions & 34 deletions spec/unit/puppet/util/ec2.rb

This file was deleted.

13 changes: 13 additions & 0 deletions tests/sudoers/sudoers-fakenamevar.pp
@@ -0,0 +1,13 @@
resources { 'sudoers':
purge => true,
}
sudoers{'fake_namevar_23':
ensure => present,
users => ['dan1', 'dan2'],
hosts => 'ALL',
commands => [
'(root) /usr/bin/su - easapp',
'(easapp)/usr/local/eas-ts/bin/appctl',
],
type => 'user_spec',
}
5 changes: 4 additions & 1 deletion tests/sudoers/test2.pp
Expand Up @@ -7,14 +7,17 @@
'(easapp)/usr/local/eas-ts/bin/appctl',
],
type => 'user_spec',
target => '/tmp/sudoers.test',
}
sudoers{'ALIAS_NAME':
ensure => present,
sudo_alias => 'Cmnd',
items => ['/bin/true', '/usr/bin/su - bob'],
type => 'alias',
target => '/tmp/sudoers.test',
}
sudoers{'Defaults@host':
parameters => ['x=y', 'one=1', 'two=2'],
type => 'default',
}
target => '/tmp/sudoers.test',
}

0 comments on commit 350a018

Please sign in to comment.