1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Write tests for the token revocation endpoint

This commit is contained in:
Quentin Gliech
2023-02-20 15:52:01 +01:00
parent 543b4b229f
commit a6cd4412c1
4 changed files with 187 additions and 2 deletions

View File

@@ -367,6 +367,7 @@ where
#[cfg(test)]
async fn test_state(pool: sqlx::PgPool) -> Result<AppState, anyhow::Error> {
use mas_email::MailTransport;
use mas_keystore::{JsonWebKey, JsonWebKeySet, PrivateKey};
use crate::passwords::Hasher;
@@ -378,8 +379,13 @@ async fn test_state(pool: sqlx::PgPool) -> Result<AppState, anyhow::Error> {
let templates = Templates::load(workspace_root.join("templates"), url_builder.clone()).await?;
// TODO: add test keys to the store
let key_store = Keystore::default();
// TODO: add more test keys to the store
let rsa =
PrivateKey::load_pem(include_str!("../../keystore/tests/keys/rsa.pkcs1.pem")).unwrap();
let rsa = JsonWebKey::new(rsa).with_kid("test-rsa");
let jwks = JsonWebKeySet::new(vec![rsa]);
let key_store = Keystore::new(jwks);
let encrypter = Encrypter::new(&[0x42; 32]);