Skip to content

Commit

Permalink
test: verify test_send_location_beacon_with_expired_live_share
Browse files Browse the repository at this point in the history
  • Loading branch information
torrybr committed Jul 27, 2024
1 parent ab6d039 commit dd25293
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions crates/matrix-sdk/tests/integration/room/joined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,61 @@ async fn test_send_location_beacon_fails_without_starting_live_share() {

let room = client.get_room(&DEFAULT_TEST_ROOM_ID).unwrap();

let result = room.send_location_beacon("geo:48.8588448,2.2943506".to_owned()).await;
let response = room.send_location_beacon("geo:48.8588448,2.2943506".to_owned()).await;

assert!(result.is_err());
assert!(response.is_err());
}

#[async_test]
async fn test_send_location_beacon_with_expired_live_share() {
let (client, server) = logged_in_client_with_server().await;

mock_sync(
&server,
json!({
"next_batch": "s526_47314_0_7_1_1_1_1_1",
"rooms": {
"join": {
*DEFAULT_TEST_ROOM_ID: {
"state": {
"events": [
{
"content": {
"description": "Live Share",
"live": false,
"org.matrix.msc3488.ts": 1_636_829_458,
"timeout": 3000,
"org.matrix.msc3488.asset": { "type": "m.self" }
},
"event_id": "$15139375514XsgmR:localhost",
"origin_server_ts": 1_636_829_458,
"sender": "@example:localhost",
"state_key": "@example:localhost",
"type": "org.matrix.msc3672.beacon_info",
"unsigned": {
"age": 7034220
}
},
]
}
}
}
}

}),
None,
)
.await;

mock_encryption_state(&server, false).await;

let sync_settings = SyncSettings::new().timeout(Duration::from_millis(3000));

client.sync_once(sync_settings).await.unwrap();

let room = client.get_room(&DEFAULT_TEST_ROOM_ID).unwrap();

let response = room.send_location_beacon("geo:48.8588448,2.2943506".to_owned()).await;

assert!(response.is_err());
}

0 comments on commit dd25293

Please sign in to comment.