Sha256: 490438764c8685e97ab4bcb85bf3d5fc2382a59351968812ed06d26ecd7d9c45

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

module PuppetTest::ResourceTesting
    Parser = Puppet::Parser
    AST = Puppet::Parser::AST

    def mkevaltest(parser = nil)
        parser ||= mkparser
        @parser.newdefine("evaltest",
            :arguments => [%w{one}, ["two", stringobj("755")]],
            :code => resourcedef("file", "/tmp",
                "owner" => varref("one"), "mode" => varref("two"))
        )
    end

    def mkresource(args = {})
        args[:source] ||= "source"
        args[:scope] ||= mkscope

        {:type => "resource", :title => "testing",
            :source => "source", :scope => "scope"}.each do |param, value|
                args[param] ||= value
        end

        params = args[:params] || {:one => "yay", :three => "rah"}
        if args[:params] == :none
            args.delete(:params)
        else
            args[:params] = paramify args[:source], params
        end

        Parser::Resource.new(args)
    end

    def param(name, value, source)
        Parser::Resource::Param.new(:name => name, :value => value, :source => source)
    end

    def paramify(source, hash)
        hash.collect do |name, value|
            Parser::Resource::Param.new(
                :name => name, :value => value, :source => source
            )
        end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-0.25.5 test/lib/puppettest/resourcetesting.rb
puppet-0.25.4 test/lib/puppettest/resourcetesting.rb
puppet-0.25.3 test/lib/puppettest/resourcetesting.rb
puppet-0.24.9 test/lib/puppettest/resourcetesting.rb
puppet-0.25.2 test/lib/puppettest/resourcetesting.rb
puppet-0.25.1 test/lib/puppettest/resourcetesting.rb
puppet-0.25.0 test/lib/puppettest/resourcetesting.rb
puppet-0.24.0 test/lib/puppettest/resourcetesting.rb
puppet-0.24.3 test/lib/puppettest/resourcetesting.rb
puppet-0.24.2 test/lib/puppettest/resourcetesting.rb
puppet-0.24.1 test/lib/puppettest/resourcetesting.rb
puppet-0.24.4 test/lib/puppettest/resourcetesting.rb
puppet-0.24.5 test/lib/puppettest/resourcetesting.rb
puppet-0.24.6 test/lib/puppettest/resourcetesting.rb
puppet-0.24.7 test/lib/puppettest/resourcetesting.rb
puppet-0.24.8 test/lib/puppettest/resourcetesting.rb