events: Fix recently broken tests

This commit is contained in:
Jonas Platte 2020-11-24 03:24:58 +01:00
parent 60d12470c9
commit 1dee89393a
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 11 additions and 2 deletions

View File

@ -182,6 +182,11 @@ fn deserialize_avatar_without_prev_content() {
"type": "m.room.avatar" "type": "m.room.avatar"
}); });
let expected_url = "http://www.matrix.org";
#[cfg(feature = "unstable-pre-spec")]
let expected_url = Some(expected_url.to_owned());
assert_matches!( assert_matches!(
from_json_value::<Raw<StateEvent<AnyStateEventContent>>>(json_data) from_json_value::<Raw<StateEvent<AnyStateEventContent>>>(json_data)
.unwrap() .unwrap()
@ -233,7 +238,7 @@ fn deserialize_avatar_without_prev_content() {
&& *thumbnail_url == "mxc://matrix.org" && *thumbnail_url == "mxc://matrix.org"
) )
) )
&& url == "http://www.matrix.org" && url == expected_url
&& unsigned.is_empty() && unsigned.is_empty()
); );
} }

View File

@ -117,13 +117,17 @@ fn deserialize_stripped_state_events() {
match event { match event {
AnyStrippedStateEvent::RoomAvatar(event) => { AnyStrippedStateEvent::RoomAvatar(event) => {
let image_info = event.content.info.unwrap(); let image_info = event.content.info.unwrap();
let expected_url = "https://example.com/image.jpg";
#[cfg(feature = "unstable-pre-spec")]
let expected_url = Some(expected_url.to_owned());
assert_eq!(image_info.height.unwrap(), uint!(128)); assert_eq!(image_info.height.unwrap(), uint!(128));
assert_eq!(image_info.width.unwrap(), uint!(128)); assert_eq!(image_info.width.unwrap(), uint!(128));
assert_eq!(image_info.mimetype.unwrap(), "image/jpeg"); assert_eq!(image_info.mimetype.unwrap(), "image/jpeg");
assert_eq!(image_info.size.unwrap(), uint!(1024)); assert_eq!(image_info.size.unwrap(), uint!(1024));
assert_eq!(image_info.thumbnail_info.unwrap().size.unwrap(), uint!(32)); assert_eq!(image_info.thumbnail_info.unwrap().size.unwrap(), uint!(32));
assert_eq!(event.content.url, "https://example.com/image.jpg"); assert_eq!(event.content.url, expected_url);
assert_eq!(event.state_key, ""); assert_eq!(event.state_key, "");
assert_eq!(event.sender.to_string(), "@example:localhost"); assert_eq!(event.sender.to_string(), "@example:localhost");
} }