Skip to content

Commit

Permalink
test: rename create_session_for to create_session_for_test_helper
Browse files Browse the repository at this point in the history
To make it easier to see it's a test function when looking up callers/callees.
  • Loading branch information
bnjbvr committed Jan 9, 2024
1 parent 13718c6 commit 4c0c482
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions crates/matrix-sdk-crypto/src/gossiping/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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?;
Expand Down
5 changes: 4 additions & 1 deletion crates/matrix-sdk-crypto/src/olm/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/session_manager/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c0c482

Please sign in to comment.