From ea3142da5d0eac32beaf94c48ed5ca5ede3ec983 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Mon, 8 Nov 2021 09:47:19 +0100 Subject: [PATCH] ldap: test message handler --- server/src/infra/ldap_handler.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/infra/ldap_handler.rs b/server/src/infra/ldap_handler.rs index 11adf71..012b244 100644 --- a/server/src/infra/ldap_handler.rs +++ b/server/src/infra/ldap_handler.rs @@ -770,13 +770,21 @@ mod tests { let mut ldap_handler = LdapHandler::new(mock, "dc=example,dc=com".to_string(), "test".to_string()); - let request = LdapBindRequest { + let request = LdapOp::BindRequest(LdapBindRequest { dn: "cn=bob,ou=people,dc=example,dc=com".to_string(), cred: LdapBindCred::Simple("pass".to_string()), - }; + }); assert_eq!( - ldap_handler.do_bind(&request).await.0, - LdapResultCode::Success + ldap_handler.handle_ldap_message(request).await, + Some(vec![LdapOp::BindResponse(LdapBindResponse { + res: LdapResult { + code: LdapResultCode::Success, + matcheddn: "".to_string(), + message: "".to_string(), + referral: vec![], + }, + saslcreds: None, + })]), ); }