summaryrefslogtreecommitdiffstats
path: root/test/network/handler
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
committerLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
commit40375a8fc34dbd85d87f507ba72c7394b25b7271 (patch)
treeefd5a93980b042b73322bd31e6fdb41203d07576 /test/network/handler
parent93eeff59d807261ed154cc104e318ae604602430 (diff)
parent8f5800f0608dff46407cb5f23ee73f314fe051e8 (diff)
downloadpuppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.gz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.xz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.zip
Merge branch '0.24.x' into merging
Conflicts: test/ral/type/filesources.rb
Diffstat (limited to 'test/network/handler')
-rwxr-xr-xtest/network/handler/master.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb
index 17bf1b3cc..bbdc021b9 100755
--- a/test/network/handler/master.rb
+++ b/test/network/handler/master.rb
@@ -56,3 +56,37 @@ class TestMaster < Test::Unit::TestCase
@master.getconfig("facts", "yaml", "foo.com")
end
end
+
+class TestMasterFormats < Test::Unit::TestCase
+ def setup
+ @facts = stub('facts', :save => nil)
+ Puppet::Node::Facts.stubs(:new).returns(@facts)
+
+ @master = Puppet::Network::Handler.master.new(:Code => "")
+ @master.stubs(:decode_facts)
+
+ @catalog = stub 'catalog', :extract => ""
+ Puppet::Node::Catalog.stubs(:find).returns(@catalog)
+ end
+
+ def test_marshal_can_be_used
+ @catalog.expects(:extract).returns "myextract"
+
+ Marshal.expects(:dump).with("myextract").returns "eh"
+
+ @master.getconfig("facts", "marshal", "foo.com")
+ end
+
+ def test_yaml_can_be_used
+ extract = mock 'extract'
+ @catalog.expects(:extract).returns extract
+
+ extract.expects(:to_yaml).returns "myaml"
+
+ @master.getconfig("facts", "yaml", "foo.com")
+ end
+
+ def test_failure_when_non_yaml_or_marshal_is_used
+ assert_raise(RuntimeError) { @master.getconfig("facts", "blah", "foo.com") }
+ end
+end