Skip to content

Commit

Permalink
test: validate body of request
Browse files Browse the repository at this point in the history
  • Loading branch information
torrybr committed Jul 25, 2024
1 parent 74156ac commit a604eb3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/matrix-sdk/tests/integration/room/joined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,17 @@ async fn test_make_reply_event_doesnt_require_event_cache() {
async fn test_start_live_location_share_for_room() {
let (client, server) = logged_in_client_with_server().await;

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

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

0 comments on commit a604eb3

Please sign in to comment.