diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-05-31 09:15:37 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-05-31 09:15:37 -0700 |
| commit | 9834dcdd831092464143700010ae73544eea42e8 (patch) | |
| tree | 70aa53510b6660fedf0ae445b57581f6359bee04 /spec/unit | |
| parent | d0592fabd27472ba0f5586393eff20e536f8766a (diff) | |
| parent | c02126df4804b42ecaca2cdff675be9c4e24aa54 (diff) | |
| download | puppet-9834dcdd831092464143700010ae73544eea42e8.tar.gz puppet-9834dcdd831092464143700010ae73544eea42e8.tar.xz puppet-9834dcdd831092464143700010ae73544eea42e8.zip | |
Merge branch 'ticket/2.7.x/5966-auth-conf-hostname-regex' into 2.7.x
* ticket/2.7.x/5966-auth-conf-hostname-regex:
(#5966) Add support for hostname regular expressions in auth.conf
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/network/authstore_spec.rb | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/spec/unit/network/authstore_spec.rb b/spec/unit/network/authstore_spec.rb index d62c8abaa..d5ff42d6e 100755 --- a/spec/unit/network/authstore_spec.rb +++ b/spec/unit/network/authstore_spec.rb @@ -4,11 +4,11 @@ require 'spec_helper' require 'puppet/network/authconfig' describe Puppet::Network::AuthStore do - describe "when checking if the acl has some entries" do - before :each do - @authstore = Puppet::Network::AuthStore.new - end + before :each do + @authstore = Puppet::Network::AuthStore.new + end + describe "when checking if the acl has some entries" do it "should be empty if no ACE have been entered" do @authstore.should be_empty end @@ -31,6 +31,37 @@ describe Puppet::Network::AuthStore do @authstore.should_not be_empty end end + + describe "when checking global allow" do + it "should not be enabled by default" do + @authstore.should_not be_globalallow + @authstore.should_not be_allowed('foo.bar.com', '192.168.1.1') + end + + it "should always allow when enabled" do + @authstore.allow('*') + + @authstore.should be_globalallow + @authstore.should be_allowed('foo.bar.com', '192.168.1.1') + end + end + + describe "when checking a regex type of allow" do + before :each do + @authstore.allow('/^(test-)?host[0-9]+\.other-domain\.(com|org|net)$|some-domain\.com/') + @ip = '192.168.1.1' + end + ['host5.other-domain.com', 'test-host12.other-domain.net', 'foo.some-domain.com'].each { |name| + it "should allow the host #{name}" do + @authstore.should be_allowed(name, @ip) + end + } + ['host0.some-other-domain.com',''].each { |name| + it "should not allow the host #{name}" do + @authstore.should_not be_allowed(name, @ip) + end + } + end end describe Puppet::Network::AuthStore::Declaration do |
