summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-04 16:55:15 -0500
committerLuke Kanies <luke@madstop.com>2007-10-04 16:55:15 -0500
commita93db8728ddc9a4b26dec738ff39863666ea229e (patch)
treeedcfef3751e41451b51961e1cf17b7d9a8fdcdc5 /spec
parent9984a3520dd061acec98495ddd5a21b6126376f4 (diff)
downloadpuppet-a93db8728ddc9a4b26dec738ff39863666ea229e.tar.gz
puppet-a93db8728ddc9a4b26dec738ff39863666ea229e.tar.xz
puppet-a93db8728ddc9a4b26dec738ff39863666ea229e.zip
Adding another test to the ldap node source -- we make
sure we throw an appropriate exception if a parent is specified but we cannot find it.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/indirector/ldap/node.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/unit/indirector/ldap/node.rb b/spec/unit/indirector/ldap/node.rb
index 739a2a5b0..6667efdd5 100755
--- a/spec/unit/indirector/ldap/node.rb
+++ b/spec/unit/indirector/ldap/node.rb
@@ -82,7 +82,7 @@ describe Puppet::Indirector::Ldap::Node, " when searching for nodes" do
end
end
-describe Puppet::Indirector::Ldap::Node, " when a parent node exists" do
+describe Puppet::Indirector::Ldap::Node, " when a parent node is specified" do
include LdapNodeSearching
before do
@@ -99,6 +99,15 @@ describe Puppet::Indirector::Ldap::Node, " when a parent node exists" do
@searcher.stubs(:parent_attribute).returns(:parent)
end
+ it "should fail if the parent cannot be found" do
+ @connection.stubs(:search).with { |*args| args[2] == 'parent' }.returns("whatever")
+
+ @entry.stubs(:to_hash).returns({})
+ @entry.stubs(:vals).with(:parent).returns(%w{parent})
+
+ proc { @searcher.find("mynode") }.should raise_error(Puppet::Error)
+ end
+
it "should add any parent classes to the node's classes" do
@entry.stubs(:to_hash).returns({})
@entry.stubs(:vals).with(:parent).returns(%w{parent})