diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2010-12-16 11:34:09 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2010-12-16 11:34:09 -0800 |
| commit | a2ff092d8302e09aa79f9bb16636f8298316c3c7 (patch) | |
| tree | cb67d36e37e252edceef1cd848cc32d679f5d20e /test/network/handler/master.rb | |
| parent | 4b35402ba85d8842d757becec5c8a7bf4d6f6654 (diff) | |
| parent | 480c399f183627f5f588e9dc9f5f86f683c0e468 (diff) | |
| download | puppet-a2ff092d8302e09aa79f9bb16636f8298316c3c7.tar.gz puppet-a2ff092d8302e09aa79f9bb16636f8298316c3c7.tar.xz puppet-a2ff092d8302e09aa79f9bb16636f8298316c3c7.zip | |
Merge branch 'next'
Diffstat (limited to 'test/network/handler/master.rb')
| -rwxr-xr-x | test/network/handler/master.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 81869ac06..4c0374a76 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/master' @@ -13,7 +13,7 @@ class TestMaster < Test::Unit::TestCase @master = Puppet::Network::Handler.master.new(:Manifest => tempfile) @catalog = stub 'catalog', :extract => "" - Puppet::Resource::Catalog.stubs(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) end def teardown @@ -32,15 +32,17 @@ class TestMaster < Test::Unit::TestCase def test_hostname_is_used_if_client_is_missing @master.expects(:decode_facts).returns("hostname" => "yay") - Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(stub('facts', :save => nil)) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts) + Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(facts) @master.getconfig("facts") end def test_facts_are_saved - facts = mock('facts') + facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.expects(:new).returns(facts) - facts.expects(:save) + Puppet::Node::Facts.indirection.expects(:save).with(facts) @master.stubs(:decode_facts) @@ -48,12 +50,13 @@ class TestMaster < Test::Unit::TestCase end def test_catalog_is_used_for_compiling - facts = stub('facts', :save => nil) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts) Puppet::Node::Facts.stubs(:new).returns(facts) @master.stubs(:decode_facts) - Puppet::Resource::Catalog.expects(:find).with("foo.com").returns(@catalog) + Puppet::Resource::Catalog.indirection.expects(:find).with("foo.com").returns(@catalog) @master.getconfig("facts", "yaml", "foo.com") end @@ -61,14 +64,15 @@ end class TestMasterFormats < Test::Unit::TestCase def setup - @facts = stub('facts', :save => nil) + @facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.stubs(:new).returns(@facts) + Puppet::Node::Facts.indirection.stubs(:save) @master = Puppet::Network::Handler.master.new(:Code => "") @master.stubs(:decode_facts) @catalog = stub 'catalog', :extract => "" - Puppet::Resource::Catalog.stubs(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) end def test_marshal_can_be_used |
