cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 1 | use matrix_sdk::{ |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 2 | Room, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 3 | ruma::{ |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 4 | UInt, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 5 | api::client::push::get_notifications::v3, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 6 | event_id, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 7 | events::{AnySyncTimelineEvent, Mentions}, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 8 | owned_user_id, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 9 | push::{Action, EventMatchConditionData, NewConditionalPushRule, PushCondition, Ruleset}, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 10 | room_id, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 11 | serde::Raw, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 12 | }, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 13 | test_utils::mocks::MatrixMockServer, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 14 | }; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 15 | use matrix_sdk_test::{JoinedRoomBuilder, event_factory::EventFactory}; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 16 | use serde_json::json; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 17 | use std::time::Duration; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 18 | use wiremock::{ |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 19 | Mock, ResponseTemplate, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 20 | matchers::{method, path, query_param}, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 21 | }; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 22 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 23 | fn explicit_mention( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 24 | room_id: &matrix_sdk::ruma::RoomId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 25 | event_id: &matrix_sdk::ruma::EventId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 26 | sender: &matrix_sdk::ruma::UserId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 27 | mentioned: &matrix_sdk::ruma::UserId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 28 | ) -> Raw<AnySyncTimelineEvent> { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 29 | EventFactory::new() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 30 | .room(room_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 31 | .text_msg("hello") |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 32 | .mentions(Mentions::with_user_ids([mentioned.to_owned()])) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 33 | .event_id(event_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 34 | .sender(sender) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 35 | .into_raw_sync() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 36 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 37 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 38 | fn assert_mention_actions(actions: &[Action]) { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 39 | assert!( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 40 | actions |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 41 | .iter() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 42 | .any(|action| matches!(action, Action::Notify)) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 43 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 44 | assert!(actions.iter().any(Action::is_highlight)); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 45 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 46 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 47 | async fn sync_room_with_mention( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 48 | server: &MatrixMockServer, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 49 | client: &matrix_sdk::Client, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 50 | room_id: &matrix_sdk::ruma::RoomId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 51 | event_id: &matrix_sdk::ruma::EventId, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 52 | ) { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 53 | let user_id = client.user_id().unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 54 | let factory = EventFactory::new().room(room_id); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 55 | let sender = owned_user_id!("@alice:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 56 | let event = explicit_mention(room_id, event_id, &sender, user_id); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 57 | let rules = Ruleset::server_default(user_id); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 58 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 59 | server |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 60 | .mock_sync() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 61 | .ok_and_run(client, |builder| { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 62 | builder.add_global_account_data(factory.push_rules(rules)); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 63 | builder.add_joined_room( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 64 | JoinedRoomBuilder::new(room_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 65 | .add_state_event(factory.member(user_id)) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 66 | .add_timeline_event(event), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 67 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 68 | }) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 69 | .await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 70 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 71 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 72 | async fn actions_for(room: &Room, event: &Raw<AnySyncTimelineEvent>) -> Option<Vec<Action>> { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 73 | room.event_push_actions(event).await.unwrap() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 74 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 75 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 76 | #[tokio::test] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 77 | async fn joined_room_update_exposes_mention_actions_without_opening_a_ui_timeline() { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 78 | let server = MatrixMockServer::new().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 79 | let client = server.client_builder().build().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 80 | let room_id = room_id!("!mentions:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 81 | let event_id = event_id!("$mention:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 82 | let mut updates = client.subscribe_to_all_room_updates(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 83 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 84 | sync_room_with_mention(&server, &client, room_id, event_id).await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 85 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 86 | let room_updates = tokio::time::timeout(Duration::from_secs(2), updates.recv()) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 87 | .await |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 88 | .unwrap() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 89 | .unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 90 | let joined = room_updates |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 91 | .joined |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 92 | .get(room_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 93 | .expect("the joined room update was absent"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 94 | let event = joined |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 95 | .timeline |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 96 | .events |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 97 | .iter() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 98 | .find(|event| event.event_id().as_deref().map(|id| id.as_str()) == Some(event_id.as_str())) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 99 | .expect("the explicit mention was absent from the room update"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 100 | let event_json: serde_json::Value = |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 101 | serde_json::from_str(event.kind.raw().json().get()).unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 102 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 103 | assert_eq!( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 104 | event_json["content"]["m.mentions"]["user_ids"], |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 105 | json!([client.user_id().unwrap().as_str()]) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 106 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 107 | assert_mention_actions( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 108 | event |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 109 | .push_actions() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 110 | .expect("push actions were not computed"), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 111 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 112 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 113 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 114 | #[tokio::test] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 115 | async fn event_cache_generic_update_finds_the_mention_without_opening_a_ui_timeline() { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 116 | let server = MatrixMockServer::new().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 117 | let client = server.client_builder().build().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 118 | let room_id = room_id!("!cached-mentions:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 119 | let event_id = event_id!("$cached-mention:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 120 | client.event_cache().subscribe().unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 121 | let mut updates = client.event_cache().subscribe_to_room_generic_updates(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 122 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 123 | sync_room_with_mention(&server, &client, room_id, event_id).await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 124 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 125 | let update = tokio::time::timeout(Duration::from_secs(2), updates.recv()) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 126 | .await |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 127 | .unwrap() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 128 | .unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 129 | assert_eq!(update.room_id, room_id); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 130 | let room = client.get_room(room_id).unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 131 | let (event_cache, _drop_handles) = room.event_cache().await.unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 132 | let event = event_cache.find_event(event_id).await.unwrap().unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 133 | assert_eq!( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 134 | event.event_id().as_deref().map(|id| id.as_str()), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 135 | Some(event_id.as_str()) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 136 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 137 | assert_mention_actions( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 138 | event |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 139 | .push_actions() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 140 | .expect("cached push actions were absent"), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 141 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 142 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 143 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 144 | #[tokio::test] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 145 | async fn ignored_sender_and_muted_room_actions_remain_sdk_push_rule_results() { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 146 | let server = MatrixMockServer::new().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 147 | let client = server.client_builder().build().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 148 | let ignored_room_id = room_id!("!ignored-sender:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 149 | let muted_room_id = room_id!("!muted-room:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 150 | let ignored_sender = owned_user_id!("@ignored:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 151 | let own_user = client.user_id().unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 152 | let factory = EventFactory::new(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 153 | let ignored_event_id = event_id!("$ignored-mention:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 154 | let muted_event_id = event_id!("$muted-message:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 155 | let ignored_event = |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 156 | explicit_mention(ignored_room_id, ignored_event_id, &ignored_sender, own_user); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 157 | let sender = owned_user_id!("@alice:localhost"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 158 | let muted_event = explicit_mention(muted_room_id, muted_event_id, &sender, own_user); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 159 | let mut rules = Ruleset::server_default(own_user); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 160 | rules.override_.shift_insert( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 161 | 1, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 162 | NewConditionalPushRule::new( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 163 | "mute-room".to_owned(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 164 | vec![PushCondition::EventMatch(EventMatchConditionData::new( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 165 | "room_id".to_owned(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 166 | muted_room_id.to_string(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 167 | ))], |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 168 | Vec::new(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 169 | ) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 170 | .into(), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 171 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 172 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 173 | server |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 174 | .mock_sync() |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 175 | .ok_and_run(&client, |builder| { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 176 | builder.add_global_account_data(factory.ignored_user_list([ignored_sender.clone()])); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 177 | builder.add_global_account_data(factory.push_rules(rules)); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 178 | builder.add_joined_room( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 179 | JoinedRoomBuilder::new(ignored_room_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 180 | .add_state_event(EventFactory::new().room(ignored_room_id).member(own_user)) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 181 | .add_timeline_event(ignored_event.clone()), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 182 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 183 | builder.add_joined_room( |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 184 | JoinedRoomBuilder::new(muted_room_id) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 185 | .add_state_event(EventFactory::new().room(muted_room_id).member(own_user)) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 186 | .add_timeline_event(muted_event.clone()), |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 187 | ); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 188 | }) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 189 | .await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 190 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 191 | assert!(client.is_user_ignored(&ignored_sender).await); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 192 | let ignored_room = client.get_room(ignored_room_id).unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 193 | let ignored_actions = actions_for(&ignored_room, &ignored_event) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 194 | .await |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 195 | .expect("the ignored sender's push actions could not be computed"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 196 | assert_mention_actions(&ignored_actions); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 197 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 198 | let muted_room = client.get_room(muted_room_id).unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 199 | let muted_actions = actions_for(&muted_room, &muted_event) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 200 | .await |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 201 | .expect("the muted room's push actions could not be computed"); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 202 | assert!(muted_actions.is_empty()); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 203 | } |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 204 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 205 | #[tokio::test] |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 206 | async fn notifications_v3_request_round_trips_opaque_pagination() { |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 207 | let server = MatrixMockServer::new().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 208 | let client = server.client_builder().build().await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 209 | let cursor = "opaque / cursor?x=1&y=2"; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 210 | let next_cursor = "next / cursor?x=3&y=4"; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 211 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 212 | Mock::given(method("GET")) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 213 | .and(path("/_matrix/client/v3/notifications")) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 214 | .and(query_param("from", cursor)) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 215 | .and(query_param("limit", "8")) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 216 | .and(query_param("only", "highlight")) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 217 | .respond_with(ResponseTemplate::new(200).set_body_json(json!({ |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 218 | "next_token": next_cursor, |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 219 | "notifications": [], |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 220 | }))) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 221 | .expect(1) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 222 | .mount(server.server()) |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 223 | .await; |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 224 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 225 | let mut request = v3::Request::new(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 226 | request.from = Some(cursor.to_owned()); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 227 | request.limit = Some(UInt::new(8).unwrap()); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 228 | request.only = Some("highlight".to_owned()); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 229 | let response = client.send(request).await.unwrap(); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 230 | |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 231 | assert_eq!(response.next_token.as_deref(), Some(next_cursor)); |
cbb715e11963 | atagen | 2026-10-24 23:24 UTC | 232 | } |