diff options
author | Steve Kemp <steve@steve.org.uk> | 2013-02-13 10:24:06 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2013-02-13 10:24:06 +0000 |
commit | 7f869861d27977d8f439d88a67806ae2be4d9eda (patch) | |
tree | 9dda9382f8c7fcf27952f5fec1336d138b0a9442 | |
parent | 0108169c85c7404aeafbdfe1ad8176240853ef6a (diff) |
Updated to peel off a username/password.
-rw-r--r-- | lib/custodian/protocoltest/ldap.rb | 25 |
1 files changed, 23 insertions, 2 deletions
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 # @@ -35,6 +35,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? # if ( line =~ /must\s+not\s+run\s+/ ) |