mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-17 13:13:34 -04:00
Consistently use .to_owned() instead of .to_string() for &str => String
This commit is contained in:
@@ -10,4 +10,5 @@ rustflags = [
|
||||
"-Wsemicolon_in_expressions_from_macros",
|
||||
"-Wunused_import_braces",
|
||||
"-Wunused_qualifications",
|
||||
"-Wclippy::str_to_string",
|
||||
]
|
||||
|
||||
@@ -200,7 +200,7 @@ impl OlmMachine {
|
||||
if let Some(device) = device {
|
||||
Ok(self.runtime.block_on(device.verify())?.into())
|
||||
} else {
|
||||
Err(SignatureError::UnknownDevice(user_id, device_id.to_string()))
|
||||
Err(SignatureError::UnknownDevice(user_id, device_id.to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ impl From<SdkVerificationRequest> for OutgoingVerificationRequest {
|
||||
room_id: r.room_id.to_string(),
|
||||
content: serde_json::to_string(&r.content)
|
||||
.expect("Can't serialize message content"),
|
||||
event_type: r.content.event_type().to_string(),
|
||||
event_type: r.content.event_type().to_owned(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ impl From<&RoomMessageRequest> for Request {
|
||||
Self::RoomMessage {
|
||||
request_id: r.txn_id.to_string(),
|
||||
room_id: r.room_id.to_string(),
|
||||
event_type: r.content.event_type().to_string(),
|
||||
event_type: r.content.event_type().to_owned(),
|
||||
content: serde_json::to_string(&r.content).expect("Can't serialize message content"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ pub(crate) fn transform_request_path(
|
||||
) -> Result<http::Request<Bytes>> {
|
||||
let uri = request.uri();
|
||||
// remove trailing slash from path
|
||||
let path = uri.path().trim_end_matches('/').to_string();
|
||||
let path = uri.path().trim_end_matches('/').to_owned();
|
||||
|
||||
if !path.starts_with("/_matrix/app/v1/") {
|
||||
let path = match path {
|
||||
|
||||
@@ -173,13 +173,13 @@ fn calculate_room_name(
|
||||
// the `else`?
|
||||
format!("{}, and {} others", names.join(", "), (invited_joined - heroes_count))
|
||||
} else {
|
||||
"".to_string()
|
||||
"".to_owned()
|
||||
};
|
||||
|
||||
// User is alone.
|
||||
if invited_joined <= 1 {
|
||||
if names.is_empty() {
|
||||
"Empty room".to_string()
|
||||
"Empty room".to_owned()
|
||||
} else {
|
||||
format!("Empty room (was {})", names)
|
||||
}
|
||||
|
||||
@@ -330,10 +330,10 @@ impl Room {
|
||||
|
||||
if let Some(name) = &inner.base_info.name {
|
||||
let name = name.trim();
|
||||
return Ok(name.to_string());
|
||||
return Ok(name.to_owned());
|
||||
} else if let Some(alias) = &inner.base_info.canonical_alias {
|
||||
let alias = alias.alias().trim();
|
||||
return Ok(alias.to_string());
|
||||
return Ok(alias.to_owned());
|
||||
}
|
||||
inner.summary.clone()
|
||||
};
|
||||
@@ -638,7 +638,7 @@ impl RoomInfo {
|
||||
/// `false` means no update was applied as the were the same
|
||||
pub fn set_prev_batch(&mut self, prev_batch: Option<&str>) -> bool {
|
||||
if self.last_prev_batch.as_deref() != prev_batch {
|
||||
self.last_prev_batch = prev_batch.map(|p| p.to_string());
|
||||
self.last_prev_batch = prev_batch.map(|p| p.to_owned());
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
||||
@@ -171,7 +171,7 @@ impl AmbiguityCache {
|
||||
.and_then(|p| p.get(&member_event.state_key))
|
||||
.and_then(|p| p.displayname.as_deref())
|
||||
{
|
||||
Some(d.to_string())
|
||||
Some(d.to_owned())
|
||||
} else if let Some(d) = self
|
||||
.store
|
||||
.get_profile(room_id, &member_event.state_key)
|
||||
@@ -183,7 +183,7 @@ impl AmbiguityCache {
|
||||
event.content.displayname.clone()
|
||||
};
|
||||
|
||||
Some(display_name.unwrap_or_else(|| event.state_key.localpart().to_string()))
|
||||
Some(display_name.unwrap_or_else(|| event.state_key.localpart().to_owned()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -200,7 +200,7 @@ impl AmbiguityCache {
|
||||
self.store.get_users_with_display_name(room_id, old_name).await?
|
||||
};
|
||||
|
||||
Some(AmbiguityMap { display_name: old_name.to_string(), users: old_display_name_map })
|
||||
Some(AmbiguityMap { display_name: old_name.to_owned(), users: old_display_name_map })
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -235,7 +235,7 @@ impl AmbiguityCache {
|
||||
};
|
||||
|
||||
Some(AmbiguityMap {
|
||||
display_name: new_display_name.to_string(),
|
||||
display_name: new_display_name.to_owned(),
|
||||
users: new_display_name_map,
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -112,13 +112,13 @@ macro_rules! statestore_integration_tests {
|
||||
let device_id = device_id!("device");
|
||||
|
||||
let session = Session {
|
||||
access_token: "token".to_string(),
|
||||
access_token: "token".to_owned(),
|
||||
user_id: user_id.to_owned(),
|
||||
device_id: device_id.to_owned(),
|
||||
};
|
||||
store.restore_session(session).await.unwrap();
|
||||
|
||||
changes.sync_token = Some("t392-516_47314_0_7_1_1_1_11444_1".to_string());
|
||||
changes.sync_token = Some("t392-516_47314_0_7_1_1_1_11444_1".to_owned());
|
||||
|
||||
let presence_json: &JsonValue = &test_json::PRESENCE;
|
||||
let presence_raw =
|
||||
@@ -671,10 +671,10 @@ macro_rules! statestore_integration_tests {
|
||||
check_timeline_events(room_id, &store, &stored_events, messages.end.as_deref()).await;
|
||||
|
||||
// Check if limited sync removes the stored timeline
|
||||
let end_token = Some("end token".to_string());
|
||||
let end_token = Some("end token".to_owned());
|
||||
let timeline_slice = TimelineSlice::new(
|
||||
Vec::new(),
|
||||
"start token".to_string(),
|
||||
"start token".to_owned(),
|
||||
end_token.clone(),
|
||||
true,
|
||||
true,
|
||||
|
||||
@@ -112,7 +112,7 @@ impl MemoryStore {
|
||||
}
|
||||
|
||||
async fn save_filter(&self, filter_name: &str, filter_id: &str) -> Result<()> {
|
||||
self.filters.insert(filter_name.to_string(), filter_id.to_string());
|
||||
self.filters.insert(filter_name.to_owned(), filter_id.to_owned());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -582,9 +582,9 @@ impl StateChanges {
|
||||
self.state
|
||||
.entry(room_id.to_owned())
|
||||
.or_insert_with(BTreeMap::new)
|
||||
.entry(event.content().event_type().to_string())
|
||||
.entry(event.content().event_type().to_owned())
|
||||
.or_insert_with(BTreeMap::new)
|
||||
.insert(event.state_key().to_string(), raw_event);
|
||||
.insert(event.state_key().to_owned(), raw_event);
|
||||
}
|
||||
|
||||
/// Update the `StateChanges` struct with the given room with a new
|
||||
|
||||
@@ -213,7 +213,7 @@ impl StoreKey {
|
||||
pub fn decrypt<T: for<'b> Deserialize<'b>>(&self, event: EncryptedEvent) -> Result<T, Error> {
|
||||
if event.version != VERSION {
|
||||
return Err(Error::Encryption(
|
||||
"Error decrypting: Unknown ciphertext version".to_string(),
|
||||
"Error decrypting: Unknown ciphertext version".to_owned(),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ impl<'a, R: Read + ?Sized + 'a> AttachmentEncryptor<'a, R> {
|
||||
.or_insert_with(|| Base64::new(hash.as_slice().to_owned()));
|
||||
|
||||
MediaEncryptionInfo {
|
||||
version: VERSION.to_string(),
|
||||
version: VERSION.to_owned(),
|
||||
hashes: self.hashes,
|
||||
iv: self.iv,
|
||||
web_key: self.web_key,
|
||||
|
||||
@@ -1313,7 +1313,7 @@ mod test {
|
||||
own_device.set_trust_state(LocalTrust::Unset);
|
||||
|
||||
for _ in 1..=3 {
|
||||
other_outbound.encrypt_helper("foo".to_string()).await;
|
||||
other_outbound.encrypt_helper("foo".to_owned()).await;
|
||||
}
|
||||
other_outbound
|
||||
.mark_shared_with(
|
||||
|
||||
@@ -246,7 +246,7 @@ impl OlmMachine {
|
||||
let master_key = i
|
||||
.master_public_key()
|
||||
.await
|
||||
.and_then(|m| m.get_first_key().map(|m| m.to_string()));
|
||||
.and_then(|m| m.get_first_key().map(|m| m.to_owned()));
|
||||
debug!(
|
||||
master_key =? master_key,
|
||||
"Restored the cross signing identity"
|
||||
|
||||
@@ -152,7 +152,7 @@ impl Session {
|
||||
|
||||
Ok(EncryptedEventScheme::OlmV1Curve25519AesSha2(OlmV1Curve25519AesSha2Content::new(
|
||||
content,
|
||||
self.our_identity_keys.curve25519().to_string(),
|
||||
self.our_identity_keys.curve25519().to_owned(),
|
||||
))
|
||||
.into())
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ impl Utility {
|
||||
let json_object = json.as_object_mut().ok_or(SignatureError::NotAnObject)?;
|
||||
|
||||
if let Some(u) = unsigned {
|
||||
json_object.insert("unsigned".to_string(), u);
|
||||
json_object.insert("unsigned".to_owned(), u);
|
||||
}
|
||||
|
||||
json_object.insert("signatures".to_string(), signatures);
|
||||
json_object.insert("signatures".to_owned(), signatures);
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
@@ -544,8 +544,8 @@ macro_rules! cryptostore_integration_tests {
|
||||
let info: SecretInfo = RequestedKeyInfo::new(
|
||||
EventEncryptionAlgorithm::MegolmV1AesSha2,
|
||||
room_id!("!test:localhost").to_owned(),
|
||||
"test_sender_key".to_string(),
|
||||
"test_session_id".to_string(),
|
||||
"test_sender_key".to_owned(),
|
||||
"test_session_id".to_owned(),
|
||||
)
|
||||
.into();
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ impl Store {
|
||||
.inner
|
||||
.get_device(self.user_id(), self.device_id())
|
||||
.await?
|
||||
.and_then(|d| d.display_name().map(|d| d.to_string())))
|
||||
.and_then(|d| d.display_name().map(|d| d.to_owned())))
|
||||
}
|
||||
|
||||
/// Get the read-only device associated with `device_id` for `user_id`
|
||||
|
||||
@@ -332,7 +332,7 @@ impl Cancelled {
|
||||
FlowId::ToDevice(s) => AnyToDeviceEventContent::KeyVerificationCancel(
|
||||
ToDeviceKeyVerificationCancelEventContent::new(
|
||||
s.clone(),
|
||||
self.reason.to_string(),
|
||||
self.reason.to_owned(),
|
||||
self.cancel_code.clone(),
|
||||
),
|
||||
)
|
||||
@@ -342,7 +342,7 @@ impl Cancelled {
|
||||
r.clone(),
|
||||
AnyMessageEventContent::KeyVerificationCancel(
|
||||
KeyVerificationCancelEventContent::new(
|
||||
self.reason.to_string(),
|
||||
self.reason.to_owned(),
|
||||
self.cancel_code.clone(),
|
||||
Relation::new(e.clone()),
|
||||
),
|
||||
|
||||
@@ -470,7 +470,7 @@ impl QrVerification {
|
||||
|
||||
let inner: QrVerificationData = SelfVerificationNoMasterKey::new(
|
||||
flow_id.as_str().to_owned(),
|
||||
store.account.identity_keys().ed25519().to_string(),
|
||||
store.account.identity_keys().ed25519().to_owned(),
|
||||
own_master_key,
|
||||
secret,
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ pub trait SafeEncode {
|
||||
&JsValue::from([&key, KEY_SEPARATOR].concat()),
|
||||
&JsValue::from([&key, RANGE_END].concat()),
|
||||
)
|
||||
.map_err(|e| e.as_string().unwrap_or_else(|| "Creating key range failed".to_string()))
|
||||
.map_err(|e| e.as_string().unwrap_or_else(|| "Creating key range failed".to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ impl Inspector {
|
||||
RoomId::parse(r).map(|_| ()).map_err(|_| "Invalid room id given".to_owned())
|
||||
}))
|
||||
.arg(Arg::new("event-type").required(true).validator(|e| {
|
||||
EventType::try_from(e).map(|_| ()).map_err(|_| "Invalid event type".to_string())
|
||||
EventType::try_from(e).map(|_| ()).map_err(|_| "Invalid event type".to_owned())
|
||||
})),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -59,11 +59,7 @@ async fn login(
|
||||
|
||||
// Wait for sync to be done then ask the user to bootstrap.
|
||||
if !asked.load(Ordering::SeqCst) {
|
||||
tokio::spawn(bootstrap(
|
||||
(*client).clone(),
|
||||
(*user_id).clone(),
|
||||
password.to_string(),
|
||||
));
|
||||
tokio::spawn(bootstrap((*client).clone(), (*user_id).clone(), password.to_owned()));
|
||||
}
|
||||
|
||||
asked.store(true, Ordering::SeqCst);
|
||||
|
||||
@@ -55,7 +55,7 @@ impl WasmBot {
|
||||
}
|
||||
|
||||
async fn on_sync_response(&self, response: SyncResponse) -> LoopCtrl {
|
||||
console::log_1(&"Synced".to_string().into());
|
||||
console::log_1(&"Synced".to_owned().into());
|
||||
|
||||
for (room_id, room) in response.rooms.join {
|
||||
for event in room.timeline.events {
|
||||
|
||||
@@ -510,7 +510,7 @@ impl Client {
|
||||
/// }).await;
|
||||
///
|
||||
/// // Adding your custom data to the handler can be done as well
|
||||
/// let data = "MyCustomIdentifier".to_string();
|
||||
/// let data = "MyCustomIdentifier".to_owned();
|
||||
///
|
||||
/// client.register_event_handler({
|
||||
/// let data = data.clone();
|
||||
@@ -2411,7 +2411,7 @@ pub(crate) mod test {
|
||||
async fn successful_discovery() {
|
||||
let server_url = mockito::server_url();
|
||||
let domain = server_url.strip_prefix("http://").unwrap();
|
||||
let alice = UserId::parse("@alice:".to_string() + domain).unwrap();
|
||||
let alice = UserId::parse("@alice:".to_owned() + domain).unwrap();
|
||||
|
||||
let _m_well_known = mock("GET", "/.well-known/matrix/client")
|
||||
.with_status(200)
|
||||
@@ -2433,7 +2433,7 @@ pub(crate) mod test {
|
||||
async fn discovery_broken_server() {
|
||||
let server_url = mockito::server_url();
|
||||
let domain = server_url.strip_prefix("http://").unwrap();
|
||||
let alice = UserId::parse("@alice:".to_string() + domain).unwrap();
|
||||
let alice = UserId::parse("@alice:".to_owned() + domain).unwrap();
|
||||
|
||||
let _m = mock("GET", "/.well-known/matrix/client")
|
||||
.with_status(200)
|
||||
@@ -2533,8 +2533,8 @@ pub(crate) mod test {
|
||||
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
||||
let client = Client::new(homeserver).await.unwrap();
|
||||
let idp = crate::client::get_login_types::v3::IdentityProvider::new(
|
||||
"some-id".to_string(),
|
||||
"idp-name".to_string(),
|
||||
"some-id".to_owned(),
|
||||
"idp-name".to_owned(),
|
||||
);
|
||||
client
|
||||
.login_with_sso(
|
||||
@@ -2615,7 +2615,7 @@ pub(crate) mod test {
|
||||
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
||||
let room_id = room_id!("!SVkFJHzfwvuaIEawgC:localhost");
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
.create();
|
||||
@@ -2648,7 +2648,7 @@ pub(crate) mod test {
|
||||
let room = joined_client.get_joined_room(room_id);
|
||||
assert!(room.is_some());
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::LEAVE_SYNC_EVENT.to_string())
|
||||
.create();
|
||||
@@ -2666,7 +2666,7 @@ pub(crate) mod test {
|
||||
async fn account_data() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -2718,7 +2718,7 @@ pub(crate) mod test {
|
||||
} else {
|
||||
panic!("found the wrong `ErrorKind` {:?}, expected `Forbidden", kind);
|
||||
}
|
||||
assert_eq!(message, "Invalid password".to_string());
|
||||
assert_eq!(message, "Invalid password".to_owned());
|
||||
assert_eq!(status_code, http::StatusCode::from_u16(403).unwrap());
|
||||
} else {
|
||||
panic!("found the wrong `Error` type {:?}, expected `Error::RumaResponse", err);
|
||||
@@ -2733,7 +2733,7 @@ pub(crate) mod test {
|
||||
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
||||
let client = Client::new(homeserver).await.unwrap();
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/register\?.*$".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/register\?.*$".to_owned()))
|
||||
.with_status(403)
|
||||
.with_body(test_json::REGISTRATION_RESPONSE_ERR.to_string())
|
||||
.create();
|
||||
@@ -2756,7 +2756,7 @@ pub(crate) mod test {
|
||||
} else {
|
||||
panic!("found the wrong `ErrorKind` {:?}, expected `Forbidden", kind);
|
||||
}
|
||||
assert_eq!(message, "Invalid password".to_string());
|
||||
assert_eq!(message, "Invalid password".to_owned());
|
||||
assert_eq!(status_code, http::StatusCode::from_u16(403).unwrap());
|
||||
} else {
|
||||
panic!("found the wrong `Error` type {:#?}, expected `UiaaResponse`", err);
|
||||
@@ -2770,7 +2770,7 @@ pub(crate) mod test {
|
||||
async fn join_room_by_id() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/join".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/join".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::ROOM_ID.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -2790,7 +2790,7 @@ pub(crate) mod test {
|
||||
async fn join_room_by_id_or_alias() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/join/".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/join/".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::ROOM_ID.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -2814,13 +2814,13 @@ pub(crate) mod test {
|
||||
async fn invite_user_by_id() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/invite".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/invite".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -2840,14 +2840,14 @@ pub(crate) mod test {
|
||||
async fn invite_user_by_3pid() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/invite".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/invite".to_owned()))
|
||||
.with_status(200)
|
||||
// empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -2877,7 +2877,7 @@ pub(crate) mod test {
|
||||
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
||||
let client = Client::new(homeserver).await.unwrap();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/publicRooms".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/publicRooms".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::PUBLIC_ROOMS.to_string())
|
||||
.create();
|
||||
@@ -2891,7 +2891,7 @@ pub(crate) mod test {
|
||||
async fn room_search_filtered() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/publicRooms".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/publicRooms".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::PUBLIC_ROOMS.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -2910,14 +2910,14 @@ pub(crate) mod test {
|
||||
async fn leave_room() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/leave".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/leave".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -2936,14 +2936,14 @@ pub(crate) mod test {
|
||||
async fn ban_user() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/ban".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/ban".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -2963,14 +2963,14 @@ pub(crate) mod test {
|
||||
async fn kick_user() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/kick".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/kick".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -2990,14 +2990,14 @@ pub(crate) mod test {
|
||||
async fn forget_room() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/forget".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/forget".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::LEAVE_SYNC.to_string())
|
||||
@@ -3016,14 +3016,14 @@ pub(crate) mod test {
|
||||
async fn read_receipt() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/receipt".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/receipt".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3044,14 +3044,14 @@ pub(crate) mod test {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m =
|
||||
mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/read_markers".to_string()))
|
||||
mock("POST", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/read_markers".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3071,14 +3071,14 @@ pub(crate) mod test {
|
||||
async fn typing_notice() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/typing".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/typing".to_owned()))
|
||||
.with_status(200)
|
||||
// this is an empty JSON object
|
||||
.with_body(test_json::LOGOUT.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3099,13 +3099,13 @@ pub(crate) mod test {
|
||||
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/state/.*".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/state/.*".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3131,13 +3131,13 @@ pub(crate) mod test {
|
||||
async fn room_message_send() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3160,7 +3160,7 @@ pub(crate) mod test {
|
||||
async fn room_attachment_send() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.match_body(Matcher::PartialJson(json!({
|
||||
@@ -3171,7 +3171,7 @@ pub(crate) mod test {
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("content-type", "image/jpeg")
|
||||
.with_body(
|
||||
@@ -3182,7 +3182,7 @@ pub(crate) mod test {
|
||||
)
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3208,7 +3208,7 @@ pub(crate) mod test {
|
||||
async fn room_attachment_send_info() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.match_body(Matcher::PartialJson(json!({
|
||||
@@ -3221,7 +3221,7 @@ pub(crate) mod test {
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let upload_mock = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_string()))
|
||||
let upload_mock = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("content-type", "image/jpeg")
|
||||
.with_body(
|
||||
@@ -3232,7 +3232,7 @@ pub(crate) mod test {
|
||||
)
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3264,7 +3264,7 @@ pub(crate) mod test {
|
||||
async fn room_attachment_send_wrong_info() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.match_body(Matcher::PartialJson(json!({
|
||||
@@ -3277,7 +3277,7 @@ pub(crate) mod test {
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_string()))
|
||||
let _m = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("content-type", "image/jpeg")
|
||||
.with_body(
|
||||
@@ -3288,7 +3288,7 @@ pub(crate) mod test {
|
||||
)
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3319,7 +3319,7 @@ pub(crate) mod test {
|
||||
async fn room_attachment_send_info_thumbnail() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_string()))
|
||||
let _m = mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/send/".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.match_body(Matcher::PartialJson(json!({
|
||||
@@ -3339,7 +3339,7 @@ pub(crate) mod test {
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let upload_mock = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_string()))
|
||||
let upload_mock = mock("POST", Matcher::Regex(r"^/_matrix/media/r0/upload".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("content-type", "image/jpeg")
|
||||
.with_body(
|
||||
@@ -3351,7 +3351,7 @@ pub(crate) mod test {
|
||||
.expect(2)
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3395,13 +3395,13 @@ pub(crate) mod test {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m =
|
||||
mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/redact/.*?/.*?".to_string()))
|
||||
mock("PUT", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/redact/.*?/.*?".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::EVENT_ID.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3426,13 +3426,13 @@ pub(crate) mod test {
|
||||
async fn user_presence() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
.create();
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/members".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/rooms/.*/members".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::MEMBERS.to_string())
|
||||
@@ -3453,7 +3453,7 @@ pub(crate) mod test {
|
||||
async fn calculate_room_names_from_summary() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::DEFAULT_SYNC_SUMMARY.to_string())
|
||||
@@ -3470,7 +3470,7 @@ pub(crate) mod test {
|
||||
async fn invited_rooms() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::INVITE_SYNC.to_string())
|
||||
@@ -3489,7 +3489,7 @@ pub(crate) mod test {
|
||||
async fn left_rooms() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::LEAVE_SYNC.to_string())
|
||||
@@ -3508,7 +3508,7 @@ pub(crate) mod test {
|
||||
async fn sync() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -3527,7 +3527,7 @@ pub(crate) mod test {
|
||||
async fn room_names() {
|
||||
let client = logged_in_client().await;
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
@@ -3541,9 +3541,9 @@ pub(crate) mod test {
|
||||
assert_eq!(client.rooms().len(), 1);
|
||||
let room = client.get_joined_room(room_id!("!SVkFJHzfwvuaIEawgC:localhost")).unwrap();
|
||||
|
||||
assert_eq!("tutorial".to_string(), room.display_name().await.unwrap());
|
||||
assert_eq!("tutorial".to_owned(), room.display_name().await.unwrap());
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.with_body(test_json::INVITE_SYNC.to_string())
|
||||
@@ -3555,7 +3555,7 @@ pub(crate) mod test {
|
||||
assert_eq!(client.rooms().len(), 1);
|
||||
let invited_room = client.get_invited_room(room_id!("!696r7674:example.com")).unwrap();
|
||||
|
||||
assert_eq!("My Room Name".to_string(), invited_room.display_name().await.unwrap());
|
||||
assert_eq!("My Room Name".to_owned(), invited_room.display_name().await.unwrap());
|
||||
}
|
||||
|
||||
#[async_test]
|
||||
@@ -3689,7 +3689,7 @@ pub(crate) mod test {
|
||||
|
||||
let m = mock(
|
||||
"GET",
|
||||
Matcher::Regex(r"^/_matrix/media/r0/download/localhost/textfile\?.*$".to_string()),
|
||||
Matcher::Regex(r"^/_matrix/media/r0/download/localhost/textfile\?.*$".to_owned()),
|
||||
)
|
||||
.with_status(200)
|
||||
.with_body("Some very interesting text.")
|
||||
@@ -3719,7 +3719,7 @@ pub(crate) mod test {
|
||||
|
||||
let m = mock(
|
||||
"GET",
|
||||
Matcher::Regex(r"^/_matrix/media/r0/download/example%2Eorg/image\?.*$".to_string()),
|
||||
Matcher::Regex(r"^/_matrix/media/r0/download/example%2Eorg/image\?.*$".to_owned()),
|
||||
)
|
||||
.with_status(200)
|
||||
.with_body("binaryjpegdata")
|
||||
@@ -3731,7 +3731,7 @@ pub(crate) mod test {
|
||||
|
||||
let m = mock(
|
||||
"GET",
|
||||
Matcher::Regex(r"^/_matrix/media/r0/thumbnail/example%2Eorg/image\?.*$".to_string()),
|
||||
Matcher::Regex(r"^/_matrix/media/r0/thumbnail/example%2Eorg/image\?.*$".to_owned()),
|
||||
)
|
||||
.with_status(200)
|
||||
.with_body("smallerbinaryjpegdata")
|
||||
@@ -3829,7 +3829,7 @@ pub(crate) mod test {
|
||||
}
|
||||
});
|
||||
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let _m = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(sync.to_string())
|
||||
.create();
|
||||
@@ -3872,7 +3872,7 @@ pub(crate) mod test {
|
||||
let client = logged_in_client().await;
|
||||
let sync_settings = SyncSettings::new().timeout(Duration::from_millis(3000));
|
||||
|
||||
let sync = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let sync = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::SYNC.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -3889,7 +3889,7 @@ pub(crate) mod test {
|
||||
let sync_2 = mock(
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_1.*".to_string(),
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_1.*".to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -3900,7 +3900,7 @@ pub(crate) mod test {
|
||||
let sync_3 = mock(
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_2.*".to_string(),
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_2.*".to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -3912,7 +3912,7 @@ pub(crate) mod test {
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/rooms/.*/messages.*from=t392-516_47314_0_7_1_1_1_11444_1.*"
|
||||
.to_string(),
|
||||
.to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -3924,7 +3924,7 @@ pub(crate) mod test {
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/rooms/.*/messages.*from=t47409-4357353_219380_26003_2269.*"
|
||||
.to_string(),
|
||||
.to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -3932,7 +3932,7 @@ pub(crate) mod test {
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
assert_eq!(client.sync_token().await, Some("s526_47314_0_7_1_1_1_11444_1".to_string()));
|
||||
assert_eq!(client.sync_token().await, Some("s526_47314_0_7_1_1_1_11444_1".to_owned()));
|
||||
let sync_settings = SyncSettings::new()
|
||||
.timeout(Duration::from_millis(3000))
|
||||
.token("s526_47314_0_7_1_1_1_11444_1");
|
||||
@@ -3996,7 +3996,7 @@ pub(crate) mod test {
|
||||
let client = logged_in_client().await;
|
||||
let sync_settings = SyncSettings::new().timeout(Duration::from_millis(3000));
|
||||
|
||||
let sync = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_string()))
|
||||
let sync = mock("GET", Matcher::Regex(r"^/_matrix/client/r0/sync\?.*$".to_owned()))
|
||||
.with_status(200)
|
||||
.with_body(test_json::MORE_SYNC.to_string())
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
@@ -4011,7 +4011,7 @@ pub(crate) mod test {
|
||||
let sync_2 = mock(
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_2.*".to_string(),
|
||||
r"^/_matrix/client/r0/sync\?.*since=s526_47314_0_7_1_1_1_11444_2.*".to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -4023,7 +4023,7 @@ pub(crate) mod test {
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/rooms/.*/messages.*from=t392-516_47314_0_7_1_1_1_11444_1.*"
|
||||
.to_string(),
|
||||
.to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -4035,7 +4035,7 @@ pub(crate) mod test {
|
||||
"GET",
|
||||
Matcher::Regex(
|
||||
r"^/_matrix/client/r0/rooms/.*/messages.*from=t47409-4357353_219380_26003_2269.*"
|
||||
.to_string(),
|
||||
.to_owned(),
|
||||
),
|
||||
)
|
||||
.with_status(200)
|
||||
@@ -4043,7 +4043,7 @@ pub(crate) mod test {
|
||||
.match_header("authorization", "Bearer 1234")
|
||||
.create();
|
||||
|
||||
assert_eq!(client.sync_token().await, Some("s526_47314_0_7_1_1_1_11444_2".to_string()));
|
||||
assert_eq!(client.sync_token().await, Some("s526_47314_0_7_1_1_1_11444_2".to_owned()));
|
||||
let sync_settings = SyncSettings::new()
|
||||
.timeout(Duration::from_millis(3000))
|
||||
.token("s526_47314_0_7_1_1_1_11444_2");
|
||||
|
||||
Reference in New Issue
Block a user