refactor(test): remove StateTestEvent::EncryptionWithEncryptedStateEvents
This commit is contained in:
@@ -56,7 +56,8 @@ experimental-send-custom-to-device = ["e2e-encryption", "matrix-sdk-base/experim
|
||||
experimental-encrypted-state-events = [
|
||||
"e2e-encryption",
|
||||
"matrix-sdk-base/experimental-encrypted-state-events",
|
||||
"matrix-sdk-sqlite/experimental-encrypted-state-events"
|
||||
"matrix-sdk-sqlite/experimental-encrypted-state-events",
|
||||
"matrix-sdk-test?/experimental-encrypted-state-events",
|
||||
]
|
||||
|
||||
markdown = ["ruma/markdown"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use matrix_sdk::{encryption::EncryptionSettings, test_utils::mocks::MatrixMockServer};
|
||||
use matrix_sdk_test::{JoinedRoomBuilder, StateTestEvent, async_test, event_factory::EventFactory};
|
||||
use matrix_sdk_test::{JoinedRoomBuilder, async_test, event_factory::EventFactory};
|
||||
use ruma::{
|
||||
RoomVersionId, device_id, event_id,
|
||||
events::{StateEventType, room::topic::RoomTopicEventContent},
|
||||
@@ -32,7 +32,7 @@ async fn test_room_encrypted_state_event_send() {
|
||||
.build()
|
||||
.await;
|
||||
|
||||
let event_factory = EventFactory::new().room(room_id);
|
||||
let event_factory = EventFactory::new().sender(alice_user_id).room(room_id);
|
||||
|
||||
matrix_mock_server
|
||||
.mock_sync()
|
||||
@@ -40,7 +40,7 @@ async fn test_room_encrypted_state_event_send() {
|
||||
builder.add_joined_room(
|
||||
JoinedRoomBuilder::new(room_id)
|
||||
.add_state_event(event_factory.create(alice_user_id, RoomVersionId::V1))
|
||||
.add_state_event(StateTestEvent::EncryptionWithEncryptedStateEvents),
|
||||
.add_state_event(event_factory.room_encryption_with_state_encryption()),
|
||||
);
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -18,6 +18,9 @@ release = true
|
||||
test = false
|
||||
doctest = false
|
||||
|
||||
[features]
|
||||
experimental-encrypted-state-events = ["ruma/unstable-msc4362"]
|
||||
|
||||
[dependencies]
|
||||
as_variant.workspace = true
|
||||
http.workspace = true
|
||||
|
||||
@@ -996,6 +996,19 @@ impl EventFactory {
|
||||
event
|
||||
}
|
||||
|
||||
/// Create a state event for room encryption with state event encryption
|
||||
/// enabled.
|
||||
#[cfg(feature = "experimental-encrypted-state-events")]
|
||||
pub fn room_encryption_with_state_encryption(
|
||||
&self,
|
||||
) -> EventBuilder<RoomEncryptionEventContent> {
|
||||
let mut content = RoomEncryptionEventContent::with_recommended_defaults();
|
||||
content.encrypt_state_events = true;
|
||||
let mut event = self.event(content);
|
||||
event.state_key = Some("".to_owned());
|
||||
event
|
||||
}
|
||||
|
||||
/// Create a room history visibility state event.
|
||||
///
|
||||
/// This creates an `m.room.history_visibility` event with the given
|
||||
|
||||
@@ -10,16 +10,12 @@ use crate::test_json;
|
||||
|
||||
/// Test events that can be added to the state.
|
||||
pub enum StateTestEvent {
|
||||
EncryptionWithEncryptedStateEvents,
|
||||
Custom(JsonValue),
|
||||
}
|
||||
|
||||
impl From<StateTestEvent> for JsonValue {
|
||||
fn from(val: StateTestEvent) -> Self {
|
||||
match val {
|
||||
StateTestEvent::EncryptionWithEncryptedStateEvents => {
|
||||
test_json::sync_events::ENCRYPTION_WITH_ENCRYPTED_STATE_EVENTS.to_owned()
|
||||
}
|
||||
StateTestEvent::Custom(json) => json,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user