diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-08 02:22:57 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-08 02:22:57 +0000 |
| commit | a216df2bcb304ad379e152f2f59ef7d942f54f3b (patch) | |
| tree | eef3289c588cf44373fe959619d732c5a05ab7b5 /test/network/server/authconfig.rb | |
| parent | 7e07e3dc843798bdbc7a03428ca054adaff2fb72 (diff) | |
Okay, last file moves for the night. The test code has been moved to match the lib directory, and I have moved a couple of things into network/ instead of network/server, since they did not belong as much.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2180 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/network/server/authconfig.rb')
| -rwxr-xr-x | test/network/server/authconfig.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/network/server/authconfig.rb b/test/network/server/authconfig.rb new file mode 100755 index 000000000..c48282973 --- /dev/null +++ b/test/network/server/authconfig.rb @@ -0,0 +1,53 @@ +#!/usr/bin/env ruby + +$:.unshift("../../lib") if __FILE__ =~ /\.rb$/ + +require 'puppettest' + +require 'puppet/network/authconfig' + +class TestAuthConfig < Test::Unit::TestCase + include PuppetTest + + def test_parsingconfigfile + file = tempfile() + assert(Puppet[:authconfig], "No config path") + + Puppet[:authconfig] = file + + File.open(file, "w") { |f| + f.puts "[pelementserver.describe] + allow *.madstop.com + deny 10.10.1.1 + +[fileserver] + allow *.madstop.com + deny 10.10.1.1 + +[fileserver.list] + allow 10.10.1.1 +" + } + + config = nil + assert_nothing_raised { + config = Puppet::Network::AuthConfig.new(file) + } + + assert_nothing_raised { + assert(config.allowed?("pelementserver.describe", + "culain.madstop.com", "1.1.1.1"), "Did not allow host") + assert(! config.allowed?("pelementserver.describe", + "culain.madstop.com", "10.10.1.1"), "Allowed host") + assert(config.allowed?("fileserver.yay", + "culain.madstop.com", "10.1.1.1"), "Did not allow host to fs") + assert(! config.allowed?("fileserver.yay", + "culain.madstop.com", "10.10.1.1"), "Allowed host to fs") + assert(config.allowed?("fileserver.list", + "culain.madstop.com", "10.10.1.1"), "Did not allow host to fs.list") + } + end +end + +# $Id$ + |
