From 04d1fd4b8aee93f92cbfc2ad7d0fb37283983a7e Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 11 Dec 2023 17:27:57 +0100 Subject: [PATCH] test: rename `create_session_for` to `create_session_for_test_helper` To make it easier to see it's a test function when looking up callers/callees. --- crates/matrix-sdk-crypto/src/gossiping/machine.rs | 8 +++++--- crates/matrix-sdk-crypto/src/olm/account.rs | 5 ++++- crates/matrix-sdk-crypto/src/session_manager/sessions.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/gossiping/machine.rs b/crates/matrix-sdk-crypto/src/gossiping/machine.rs index 711120786..2e19f5d91 100644 --- a/crates/matrix-sdk-crypto/src/gossiping/machine.rs +++ b/crates/matrix-sdk-crypto/src/gossiping/machine.rs @@ -1247,7 +1247,8 @@ mod tests { .with_transaction(|mut btr| async { let alice_account = atr.account().await?; let bob_account = btr.account().await?; - let sessions = alice_account.create_session_for(bob_account).await; + let sessions = + alice_account.create_session_for_test_helper(bob_account).await; Ok((btr, sessions)) }) .await?; @@ -1845,7 +1846,7 @@ mod tests { .with_transaction(|mut tr| async { let alice_account = tr.account().await?; let (alice_session, _) = - alice_account.create_session_for(&mut second_account).await; + alice_account.create_session_for_test_helper(&mut second_account).await; Ok((tr, alice_session)) }) .await @@ -2068,7 +2069,8 @@ mod tests { .with_transaction(|mut btr| async { let alice_account = atr.account().await?; let bob_account = btr.account().await?; - let sessions = alice_account.create_session_for(bob_account).await; + let sessions = + alice_account.create_session_for_test_helper(bob_account).await; Ok((btr, sessions)) }) .await?; diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index acd7b3a19..26e98bf9d 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -980,7 +980,10 @@ impl Account { #[cfg(any(test, feature = "testing"))] #[allow(dead_code)] /// Testing only helper to create a session for the given Account - pub async fn create_session_for(&mut self, other: &mut Account) -> (Session, Session) { + pub async fn create_session_for_test_helper( + &mut self, + other: &mut Account, + ) -> (Session, Session) { use ruma::events::dummy::ToDeviceDummyEventContent; other.generate_one_time_keys_helper(1); diff --git a/crates/matrix-sdk-crypto/src/session_manager/sessions.rs b/crates/matrix-sdk-crypto/src/session_manager/sessions.rs index 75abc7092..bf005cad6 100644 --- a/crates/matrix-sdk-crypto/src/session_manager/sessions.rs +++ b/crates/matrix-sdk-crypto/src/session_manager/sessions.rs @@ -854,7 +854,7 @@ mod tests { .store .with_transaction(|mut tr| async { let manager_account = tr.account().await.unwrap(); - let res = bob.create_session_for(manager_account).await; + let res = bob.create_session_for_test_helper(manager_account).await; Ok((tr, res)) }) .await