summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/ldap.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
committerSteve Kemp <steve@steve.org.uk>2015-04-16 16:14:06 +0100
commit91713ef347d49dca7de7dd9360d42763dd961894 (patch)
tree99f8d3e0ff368cc7bb863cdf7910ffcc629774d4 /lib/custodian/protocoltest/ldap.rb
parent1b9654c79d6bd8e24134ddeef4bf44580a726178 (diff)
Updated test-handler for new API.
This update consists of two changes: * No longer return "true" or "false" instead return "TEST_FAILED", or "TEST_SUCCEEDED". * Removed the testing of test-inversion from the class, now it lives in the base-class where it should have done all along.
Diffstat (limited to 'lib/custodian/protocoltest/ldap.rb')
-rw-r--r--lib/custodian/protocoltest/ldap.rb19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb
index c7429a6..7f8091e 100644
--- a/lib/custodian/protocoltest/ldap.rb
+++ b/lib/custodian/protocoltest/ldap.rb
@@ -55,15 +55,6 @@ module Custodian
end
#
- # Is this test inverted?
- #
- if line =~ /must\s+not\s+run\s+/
- @inverted = true
- else
- @inverted = false
- end
-
- #
# Save the port
#
if line =~ /on\s+([0-9]+)/
@@ -94,7 +85,7 @@ module Custodian
require 'ldap'
rescue LoadError
@error = 'LDAP library not available - test disabled'
- return false
+ return Custodian::TestResult::TEST_FAILED
end
# reset the error, in case we were previously executed.
@@ -122,18 +113,18 @@ module Custodian
puts "We found an LDAP result #{entry.vals('cn')}"
}
ldap.unbind
- return true
+ return Custodian::TestResult::TEST_PASSED
else
@error = "failed to bind to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
- return false
+ return Custodian::TestResult::TEST_FAILED
end
rescue LDAP::ResultError => ex
@error = "LDAP exception: #{ex} when talking to LDAP server '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
- return false
+ return Custodian::TestResult::TEST_FAILED
end
@error = "LDAP server test failed against '#{@host}' with username '#{@ldap_user}' and password '#{@ldap_pass}'"
- false
+ Custodian::TestResult::TEST_FAILED
end