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 | a11514afc5ff1510cdc3ed290df47982594a963f (patch) | |
tree | b215177af5e8684e0acda128fe9e9bfa8c3a4ade /lib | |
parent | 9bc4ac7de2d105f74130f936855a6c7598bf2c61 (diff) |
Updated to peel off a username/password.
Diffstat (limited to 'lib')
-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+/ ) |