From 7f869861d27977d8f439d88a67806ae2be4d9eda Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 13 Feb 2013 10:24:06 +0000 Subject: Updated to peel off a username/password. --- lib/custodian/protocoltest/ldap.rb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb index ab703e5..5d849c7 100644 --- a/lib/custodian/protocoltest/ldap.rb +++ b/lib/custodian/protocoltest/ldap.rb @@ -7,7 +7,7 @@ require 'custodian/protocoltest/tcp' # This object is instantiated if the parser sees a line such as: # ### -### foo.vm.bytemark.co.uk must run ldap otherwise 'auth-server fail'. +### foo.vm.bytemark.co.uk must run ldap with username 'user' and password 'xx' otherwise 'auth-server fail'. ### # # The specification of the port is optional and defaults to 389. @@ -16,7 +16,7 @@ module Custodian module ProtocolTest - class LDAPTest < TCPTest + class LDAPTest < TestFactory # @@ -34,6 +34,27 @@ module Custodian # @host = line.split( /\s+/)[0] + # + # The username/password + # + @ldap_user = nil + @ldap_pass = nil + + if ( line =~ /with\s+username\s+'([^']+)'/ ) + @ldap_user = $1.dup + end + if ( line =~ /with\s+password\s+'([^']+)'/ ) + @ldap_pass = $1.dup + end + + if ( @ldap_user.nil? ) + raise ArgumentError, "No username specified: #{@line}" + end + if ( @ldap_pass.nil? ) + raise ArgumentError, "No password specified: #{@line}" + end + + # # Is this test inverted? # -- cgit v1.2.1