Skip to content

Commit c3ea78e

Browse files
committed
fixup! convert to using global_account_data_mock_builder
1 parent 083f575 commit c3ea78e

File tree

1 file changed

+11
-1
lines changed
  • crates/matrix-sdk/src/test_utils/mocks

1 file changed

+11
-1
lines changed

crates/matrix-sdk/src/test_utils/mocks/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,7 @@ impl MatrixMockServer {
12761276
///
12771277
/// # anyhow::Ok(()) });
12781278
/// ```
1279+
#[cfg(feature = "e2e-encryption")]
12791280
pub fn mock_get_default_secret_storage_key(
12801281
&self,
12811282
) -> MockEndpoint<'_, GetDefaultSecretStorageKeyEndpoint> {
@@ -1328,6 +1329,7 @@ impl MatrixMockServer {
13281329
///
13291330
/// # anyhow::Ok(()) });
13301331
/// ```
1332+
#[cfg(feature = "e2e-encryption")]
13311333
pub fn mock_get_secret_storage_key(&self) -> MockEndpoint<'_, GetSecretStorageKeyEndpoint> {
13321334
let mock = Mock::given(method("GET"));
13331335
self.mock_endpoint(mock, GetSecretStorageKeyEndpoint).expect_default_access_token()
@@ -1342,6 +1344,7 @@ impl MatrixMockServer {
13421344
/// tokio_test::block_on(async {
13431345
/// use js_int::uint;
13441346
/// use serde_json::json;
1347+
/// use ruma::events::GlobalAccountDataEventType;
13451348
/// use matrix_sdk::test_utils::mocks::MatrixMockServer;
13461349
///
13471350
/// let mock_server = MatrixMockServer::new().await;
@@ -1354,13 +1357,14 @@ impl MatrixMockServer {
13541357
/// .mount()
13551358
/// .await;
13561359
///
1357-
/// self.client.account()
1360+
/// client.account()
13581361
/// .fetch_account_data(GlobalAccountDataEventType::from("m.cross_signing.master".to_owned()))
13591362
/// .await
13601363
/// .unwrap();
13611364
///
13621365
/// # anyhow::Ok(()) });
13631366
/// ```
1367+
#[cfg(feature = "e2e-encryption")]
13641368
pub fn mock_get_master_signing_key(&self) -> MockEndpoint<'_, GetMasterSigningKeyEndpoint> {
13651369
let mock = Mock::given(method("GET"));
13661370
self.mock_endpoint(mock, GetMasterSigningKeyEndpoint).expect_default_access_token()
@@ -3696,8 +3700,10 @@ impl<'a> MockEndpoint<'a, UpdateRecentEmojisEndpoint> {
36963700
/// A prebuilt mock for a `GET
36973701
/// /_matrix/client/v3/user/{userId}/account_data/m.secret_storage.default_key`
36983702
/// request, which fetches the ID of the default secret storage key.
3703+
#[cfg(feature = "e2e-encryption")]
36993704
pub struct GetDefaultSecretStorageKeyEndpoint;
37003705

3706+
#[cfg(feature = "e2e-encryption")]
37013707
impl<'a> MockEndpoint<'a, GetDefaultSecretStorageKeyEndpoint> {
37023708
/// Returns a mock for a successful fetch of the default secret storage key.
37033709
pub fn ok(self, user_id: &UserId, key_id: &str) -> MatrixMock<'a> {
@@ -3716,8 +3722,10 @@ impl<'a> MockEndpoint<'a, GetDefaultSecretStorageKeyEndpoint> {
37163722
/// A prebuilt mock for a `GET
37173723
/// /_matrix/client/v3/user/{userId}/account_data/m.secret_storage.key.{keyId}`
37183724
/// request, which fetches information about a secret storage key.
3725+
#[cfg(feature = "e2e-encryption")]
37193726
pub struct GetSecretStorageKeyEndpoint;
37203727

3728+
#[cfg(feature = "e2e-encryption")]
37213729
impl<'a> MockEndpoint<'a, GetSecretStorageKeyEndpoint> {
37223730
/// Returns a mock for a successful fetch of the secret storage key
37233731
pub fn ok(
@@ -3740,8 +3748,10 @@ impl<'a> MockEndpoint<'a, GetSecretStorageKeyEndpoint> {
37403748
/// A prebuilt mock for a `GET
37413749
/// /_matrix/client/v3/user/{userId}/account_data/m.cross_signing.master`
37423750
/// request, which fetches information about the master signing key.
3751+
#[cfg(feature = "e2e-encryption")]
37433752
pub struct GetMasterSigningKeyEndpoint;
37443753

3754+
#[cfg(feature = "e2e-encryption")]
37453755
impl<'a> MockEndpoint<'a, GetMasterSigningKeyEndpoint> {
37463756
/// Returns a mock for a successful fetch of the master signing key
37473757
pub fn ok<B: Serialize>(self, user_id: &UserId, key_json: B) -> MatrixMock<'a> {

0 commit comments

Comments
 (0)