Skip to content

Commit 5fcd6be

Browse files
committed
test(crypto): simplify send_and_receive_encrypted_to_device_test_helper
No need to convert the event content to a to-device request, and then convert back again.
1 parent 42b9683 commit 5fcd6be

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

crates/matrix-sdk-crypto/src/machine/test_helpers.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ use ruma::{
3030
encryption::OneTimeKey,
3131
events::dummy::ToDeviceDummyEventContent,
3232
serde::Raw,
33-
to_device::DeviceIdOrAllDevices,
3433
user_id, DeviceId, OwnedOneTimeKeyId, TransactionId, UserId,
3534
};
3635
use serde::Serialize;
3736
use serde_json::{json, Value};
3837
use tokio::sync::Mutex;
3938

4039
use crate::{
41-
machine::tests,
4240
olm::PrivateCrossSigningIdentity,
4341
store::{types::Changes, CryptoStoreWrapper, MemoryStore},
4442
types::{
4543
events::{room::encrypted::ToDeviceEncryptedEventContent, ToDeviceEvent},
46-
requests::{AnyOutgoingRequest, ToDeviceRequest},
44+
requests::AnyOutgoingRequest,
4745
DeviceKeys,
4846
},
4947
utilities::json_convert,
@@ -199,16 +197,7 @@ pub async fn send_and_receive_encrypted_to_device_test_helper(
199197
.await
200198
.expect("Should have encrypted the content");
201199

202-
let request = ToDeviceRequest::new(
203-
recipient.user_id(),
204-
DeviceIdOrAllDevices::DeviceId(recipient.device_id().to_owned()),
205-
"m.room.encrypted",
206-
raw_encrypted.cast(),
207-
);
208-
let event = ToDeviceEvent::new(
209-
sender.user_id().to_owned(),
210-
tests::to_device_requests_to_content(vec![request.clone().into()]),
211-
);
200+
let event = ToDeviceEvent::new(sender.user_id().to_owned(), raw_encrypted);
212201

213202
let event = json_convert(&event).unwrap();
214203

0 commit comments

Comments
 (0)