ldap: test message handler

This commit is contained in:
Valentin Tolmer 2021-11-08 09:47:19 +01:00 committed by nitnelave
parent 656edc3763
commit ea3142da5d

View File

@ -770,13 +770,21 @@ mod tests {
let mut ldap_handler = let mut ldap_handler =
LdapHandler::new(mock, "dc=example,dc=com".to_string(), "test".to_string()); 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(), dn: "cn=bob,ou=people,dc=example,dc=com".to_string(),
cred: LdapBindCred::Simple("pass".to_string()), cred: LdapBindCred::Simple("pass".to_string()),
}; });
assert_eq!( assert_eq!(
ldap_handler.do_bind(&request).await.0, ldap_handler.handle_ldap_message(request).await,
LdapResultCode::Success Some(vec![LdapOp::BindResponse(LdapBindResponse {
res: LdapResult {
code: LdapResultCode::Success,
matcheddn: "".to_string(),
message: "".to_string(),
referral: vec![],
},
saslcreds: None,
})]),
); );
} }