use wiremock::{
Mock, MockServer, ResponseTemplate,
matchers::{header, method, path_regex},
};
use crate::test_json;
pub async fn mock_encryption_state(server: &MockServer, is_encrypted: bool) {
let builder = Mock::given(method("GET"))
.and(path_regex(r"^/_matrix/client/r0/rooms/.*/state/m.*room.*encryption.?"))
.and(header("authorization", "Bearer 1234"));
if is_encrypted {
builder
.respond_with(
ResponseTemplate::new(200)
.set_body_json(&*test_json::sync_events::ENCRYPTION_CONTENT),
)
.mount(server)
.await;
} else {
builder
.respond_with(ResponseTemplate::new(404).set_body_json(&*test_json::NOT_FOUND))
.mount(server)
.await;
}
}