From dd252937c101ca16b33db329c7c7295d3570826a Mon Sep 17 00:00:00 2001 From: torrybr <16907963+torrybr@users.noreply.github.com> Date: Fri, 26 Jul 2024 23:18:12 -0400 Subject: [PATCH] test: verify test_send_location_beacon_with_expired_live_share --- .../tests/integration/room/joined.rs | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk/tests/integration/room/joined.rs b/crates/matrix-sdk/tests/integration/room/joined.rs index 93b6f7017dd..6a8ba193b40 100644 --- a/crates/matrix-sdk/tests/integration/room/joined.rs +++ b/crates/matrix-sdk/tests/integration/room/joined.rs @@ -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()); }