Skip to content

Commit a604eb3

Browse files
committed
test: validate body of request
1 parent 74156ac commit a604eb3

File tree

1 file changed

+16
-0
lines changed
  • crates/matrix-sdk/tests/integration/room

1 file changed

+16
-0
lines changed

crates/matrix-sdk/tests/integration/room/joined.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,17 @@ async fn test_make_reply_event_doesnt_require_event_cache() {
776776
async fn test_start_live_location_share_for_room() {
777777
let (client, server) = logged_in_client_with_server().await;
778778

779+
// Validate request body and response, partial body matching due to auto-generated
780+
// `org.matrix.msc3488.ts`
779781
Mock::given(method("PUT"))
780782
.and(path_regex(r"^/_matrix/client/r0/rooms/.*/state/org.matrix.msc3672.beacon_info/.*"))
781783
.and(header("authorization", "Bearer 1234"))
784+
.and(body_partial_json(&json!({
785+
"description": "Live Share",
786+
"live": true,
787+
"timeout": 3000,
788+
"org.matrix.msc3488.asset": { "type": "m.self" }
789+
})))
782790
.respond_with(ResponseTemplate::new(200).set_body_json(&*test_json::EVENT_ID))
783791
.mount(&server)
784792
.await;
@@ -867,9 +875,17 @@ async fn test_start_live_location_share_for_room() {
867875
async fn test_stop_sharing_live_location() {
868876
let (client, server) = logged_in_client_with_server().await;
869877

878+
// Validate request body and response, partial body matching due to auto-generated
879+
// `org.matrix.msc3488.ts`
870880
Mock::given(method("PUT"))
871881
.and(path_regex(r"^/_matrix/client/r0/rooms/.*/state/org.matrix.msc3672.beacon_info/.*"))
872882
.and(header("authorization", "Bearer 1234"))
883+
.and(body_partial_json(&json!({
884+
"description": "Live Share",
885+
"live": false,
886+
"timeout": 3000,
887+
"org.matrix.msc3488.asset": { "type": "m.self" }
888+
})))
873889
.respond_with(ResponseTemplate::new(200).set_body_json(&*test_json::EVENT_ID))
874890
.mount(&server)
875891
.await;

0 commit comments

Comments
 (0)