Add a test regarding ser/de of an UserId in a DirectUserIdentifier (#1968)
Add a test to check that a serialized UserId can be deserialized to an OwnedDirectUserIdentifier. Also fixes Clippy failures.
This commit is contained in:
parent
bc8b704e5b
commit
9af36342ff
@ -722,7 +722,7 @@ impl OutgoingResponse for UiaaResponse {
|
||||
match self {
|
||||
UiaaResponse::AuthResponse(authentication_info) => http::Response::builder()
|
||||
.header(http::header::CONTENT_TYPE, "application/json")
|
||||
.status(&http::StatusCode::UNAUTHORIZED)
|
||||
.status(http::StatusCode::UNAUTHORIZED)
|
||||
.body(ruma_common::serde::json_to_buf(&authentication_info)?)
|
||||
.map_err(Into::into),
|
||||
UiaaResponse::MatrixError(error) => error.try_into_http_response(),
|
||||
|
@ -267,5 +267,11 @@ mod tests {
|
||||
assert_eq!(alice_direct_uid_mail, alice_user_id.to_owned());
|
||||
assert_eq!(alice_user_id, alice_direct_uid_mail);
|
||||
assert_eq!(alice_user_id.to_owned(), alice_direct_uid_mail);
|
||||
|
||||
let alice_user_id = user_id!("@alice:ruma.io");
|
||||
let alice_user_id_json = to_json_value(alice_user_id).unwrap();
|
||||
let alice_direct_uid_mail: OwnedDirectUserIdentifier =
|
||||
from_json_value(alice_user_id_json).unwrap();
|
||||
assert_eq!(alice_user_id, alice_direct_uid_mail);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user