diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-10 23:24:34 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-10 23:24:34 +0000 |
commit | 2d3c920e0fdef4ca38e14677a4a670f0890ff994 (patch) | |
tree | 01dfd2f3106dd6605cd9055c306493e29fd7029c /test/ral/providers/mailalias/aliases.rb | |
parent | fdfe0a387d95045d442b945d54a6b757b9581e2e (diff) | |
download | puppet-2d3c920e0fdef4ca38e14677a4a670f0890ff994.tar.gz puppet-2d3c920e0fdef4ca38e14677a4a670f0890ff994.tar.xz puppet-2d3c920e0fdef4ca38e14677a4a670f0890ff994.zip |
Adding support for a "mailalias" type, with /etc/aliases support initially. I have not yet figured out how to best rebuild the aliases file when necessary.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2676 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/ral/providers/mailalias/aliases.rb')
-rwxr-xr-x | test/ral/providers/mailalias/aliases.rb | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/ral/providers/mailalias/aliases.rb b/test/ral/providers/mailalias/aliases.rb new file mode 100755 index 000000000..d0a95d877 --- /dev/null +++ b/test/ral/providers/mailalias/aliases.rb @@ -0,0 +1,57 @@ +#!/usr/bin/env ruby + +$:.unshift("../../../lib") if __FILE__ =~ /\.rb$/ + +require 'puppettest' +require 'puppettest/fileparsing' +require 'puppet/type/mailalias' + +class TestMailaliasAliasesProvider < Test::Unit::TestCase + include PuppetTest + include PuppetTest::FileParsing + + def setup + super + @provider = Puppet.type(:mailalias).provider(:aliases) + + @oldfiletype = @provider.filetype + + @alias = mkalias + end + + def teardown + Puppet::Util::FileType.filetype(:ram).clear + @provider.filetype = @oldfiletype + @provider.clear + super + end + + def mkalias(name = "me") + if defined? @pcount + @pcount += 1 + else + @pcount = 1 + end + args = { + :name => name, + :recipient => %w{here there} + } + + fakeresource = fakeresource(:mailalias, args[:name]) + + key = @provider.new(fakeresource) + args.each do |p,v| + key.send(p.to_s + "=", v) + end + + return key + end + + def test_data_parsing_and_generating + fakedata("data/types/mailalias").each { |file| + fakedataparse(file) + } + end +end + +# $Id$ |