'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips extraneous whitespace'|'uid =John Smith , ou = People, dc= example,dc =com'|'uid=john smith,ou=people,dc=example,dc=com'
'strips extraneous whitespace for a DN with a single RDN'|'uid = John Smith'|'uid=john smith'
'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com'
'downcases the whole string'|'UID=John Smith,ou=People,dc=example,dc=com'|'uid=john smith,ou=people,dc=example,dc=com'
'for a null DN (empty string), returns empty string and does not error'|''|''
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=John Smith\n,ou=People,dc=example,dc=com'
'does not modify casing'|'UID=John Smith,ou=People,dc=example,dc=com'|'UID=John Smith,ou=People,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ john smith,ou=people,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=john smith\\ ,ou=people,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\njohn smith,ou=people,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=john smith\\\n,ou=people,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\njohn smith,ou=people,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=john smith\n,ou=people,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=john smith,ou=people,dc=example,dc=com'
'does not treat escaped equal signs as attribute delimiters'|'uid= foo \\= bar'|'uid=foo \\= bar'
'does not treat escaped hex equal signs as attribute delimiters'|'uid= foo \\3D bar'|'uid=foo \\3D bar'
'does not treat escaped commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\, CA'|'uid=John C. Smith,ou=San Francisco\\, CA'
'does not treat escaped hex commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\2C CA'|'uid=John C. Smith,ou=San Francisco\\2C CA'
'does not treat escaped hex equal signs as attribute delimiters'|'uid= foo \\3D bar'|'uid=foo \\3d bar'
'does not treat escaped commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\, CA'|'uid=john c. smith,ou=san francisco\\, ca'
'does not treat escaped hex commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\2C CA'|'uid=john c. smith,ou=san francisco\\2c ca'
end
with_themdo
...
...
@@ -55,20 +55,20 @@ describe Gitlab::LDAP::Person do
context'given a UID'do
where(:test_description,:given,:expected)do
'strips extraneous whitespace'|' John C. Smith '|'John C. Smith'
'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=John Smith+telephoneNumber=+1 555-555-5555,ou=People,dc=example,dc=com'
'strips extraneous whitespace'|'uid =John Smith , ou = People, dc= example,dc =com'|'uid=john smith,ou=people,dc=example,dc=com'
'strips extraneous whitespace for a DN with a single RDN'|'uid = John Smith'|'uid=john smith'
'strips extraneous whitespace without modifying the multivalued RDN'|'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com'
'strips the space after the plus sign in the telephoneNumber'|'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com'|'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com'
'downcases the whole string'|'UID=John Smith,ou=People,dc=example,dc=com'|'uid=john smith,ou=people,dc=example,dc=com'
'for a null DN (empty string), returns empty string and does not error'|''|''
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=John Smith\n,ou=People,dc=example,dc=com'
'does not modify casing'|'UID=John Smith,ou=People,dc=example,dc=com'|'UID=John Smith,ou=People,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=John Smith,ou=People,dc=example,dc=com'
'does not strip the escaped leading space in an attribute value (and does not error like Net::LDAP::DN.new does)'|'uid=\\ John Smith,ou=People,dc=example,dc=com'|'uid=\\ john smith,ou=people,dc=example,dc=com'
'does not strip the escaped trailing space in an attribute value'|'uid=John Smith\\ ,ou=People,dc=example,dc=com'|'uid=john smith\\ ,ou=people,dc=example,dc=com'
'does not strip the escaped leading newline in an attribute value'|'uid=\\\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\\\njohn smith,ou=people,dc=example,dc=com'
'does not strip the escaped trailing newline in an attribute value'|'uid=John Smith\\\n,ou=People,dc=example,dc=com'|'uid=john smith\\\n,ou=people,dc=example,dc=com'
'does not strip the unescaped leading newline in an attribute value'|'uid=\nJohn Smith,ou=People,dc=example,dc=com'|'uid=\njohn smith,ou=people,dc=example,dc=com'
'does not strip the unescaped trailing newline in an attribute value'|'uid=John Smith\n ,ou=People,dc=example,dc=com'|'uid=john smith\n,ou=people,dc=example,dc=com'
'does not strip non whitespace'|'uid=John Smith,ou=People,dc=example,dc=com'|'uid=john smith,ou=people,dc=example,dc=com'
'does not treat escaped equal signs as attribute delimiters'|'uid= foo \\= bar'|'uid=foo \\= bar'
'does not treat escaped hex equal signs as attribute delimiters'|'uid= foo \\3D bar'|'uid=foo \\3D bar'
'does not treat escaped commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\, CA'|'uid=John C. Smith,ou=San Francisco\\, CA'
'does not treat escaped hex commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\2C CA'|'uid=John C. Smith,ou=San Francisco\\2C CA'
'does not treat escaped hex equal signs as attribute delimiters'|'uid= foo \\3D bar'|'uid=foo \\3d bar'
'does not treat escaped commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\, CA'|'uid=john c. smith,ou=san francisco\\, ca'
'does not treat escaped hex commas as attribute delimiters'|'uid= John C. Smith, ou=San Francisco\\2C CA'|'uid=john c. smith,ou=san francisco\\2c ca'