summaryrefslogtreecommitdiffstats
path: root/test/network/rights.rb
blob: edbcaac8090a0cf1d12d667d74832913786d1076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby

$:.unshift("../lib") if __FILE__ =~ /\.rb$/

require 'puppettest'
require 'puppet/network/rights'

class TestRights < Test::Unit::TestCase
	include PuppetTest

    def setup
        super
        @store = Puppet::Network::Rights.new
    end


    def test_rights
        assert_raise(ArgumentError, "Did not fail on unknown right") {
            @store.allowed?(:write, "host.madstop.com", "0.0.0.0")
        }

        assert_nothing_raised {
            @store.newright(:write)
        }

        assert(! @store.allowed?(:write, "host.madstop.com", "0.0.0.0"),
            "Defaulted to allowing access")

        assert_nothing_raised {
            @store[:write].info "This is a log message"
        }

        assert_logged(:info, /This is a log message/, "did not log from Rights")
    end
end

# $Id$