Fix tests

Signed-off-by: Till Wegmueller <toasterson@gmail.com>
This commit is contained in:
Till Wegmueller 2026-01-06 11:17:38 +01:00
parent 2b4922a69f
commit d39c757be5
No known key found for this signature in database
4 changed files with 19 additions and 8 deletions

View file

@ -3,8 +3,8 @@ use crate::errors::CrabError;
use crate::storage; use crate::storage;
use chrono::Utc; use chrono::Utc;
use sea_orm::{ use sea_orm::{
ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel, QueryFilter, ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel, NotSet,
Set, QueryFilter, Set,
}; };
use tokio_cron_scheduler::{Job, JobScheduler}; use tokio_cron_scheduler::{Job, JobScheduler};
use tracing::{error, info}; use tracing::{error, info};
@ -144,7 +144,7 @@ pub async fn start_job_execution(
let now = Utc::now().timestamp(); let now = Utc::now().timestamp();
let execution = job_execution::ActiveModel { let execution = job_execution::ActiveModel {
id: Set(0), // Will be auto-generated id: NotSet, // Auto-generated by database
job_name: Set(job_name.to_string()), job_name: Set(job_name.to_string()),
started_at: Set(now), started_at: Set(now),
completed_at: Set(None), completed_at: Set(None),

View file

@ -46,7 +46,17 @@ impl JwksManager {
// Ensure JWKS file exists or update from private_jwk // Ensure JWKS file exists or update from private_jwk
if !cfg.jwks_path.exists() { if !cfg.jwks_path.exists() {
let public = private_jwk.to_public_key()?; let mut public = private_jwk.to_public_key()?;
// Copy metadata from private key to public key
if let Some(kid) = private_jwk.key_id() {
public.set_key_id(kid);
}
if let Some(alg) = private_jwk.algorithm() {
public.set_algorithm(alg);
}
if let Some(use_) = private_jwk.key_use() {
public.set_key_use(use_);
}
let jwk_val: Value = serde_json::to_value(public)?; let jwk_val: Value = serde_json::to_value(public)?;
let jwks = json!({ "keys": [jwk_val] }); let jwks = json!({ "keys": [jwk_val] });
fs::write(&cfg.jwks_path, serde_json::to_string_pretty(&jwks)?)?; fs::write(&cfg.jwks_path, serde_json::to_string_pretty(&jwks)?)?;

View file

@ -7,6 +7,7 @@ pub struct Settings {
pub server: Server, pub server: Server,
pub database: Database, pub database: Database,
pub keys: Keys, pub keys: Keys,
#[serde(default)]
pub federation: Federation, pub federation: Federation,
} }

View file

@ -1342,7 +1342,7 @@ mod tests {
let test_db = TestDb::new().await; let test_db = TestDb::new().await;
let db = test_db.connection(); let db = test_db.connection();
let token = issue_access_token(&db, "test_subject", "test_client_id", "openid profile", let token = issue_access_token(&db, "test_client_id", "test_subject", "openid profile",
3600, // TTL 3600, // TTL
) )
.await .await
@ -1356,7 +1356,7 @@ mod tests {
let test_db = TestDb::new().await; let test_db = TestDb::new().await;
let db = test_db.connection(); let db = test_db.connection();
let token = issue_access_token(&db, "test_subject", "test_client_id", "openid profile", let token = issue_access_token(&db, "test_client_id", "test_subject", "openid profile",
3600, // TTL 3600, // TTL
) )
.await .await
@ -1377,7 +1377,7 @@ mod tests {
let test_db = TestDb::new().await; let test_db = TestDb::new().await;
let db = test_db.connection(); let db = test_db.connection();
let token = issue_access_token(&db, "test_subject", "test_client_id", "openid profile", let token = issue_access_token(&db, "test_client_id", "test_subject", "openid profile",
3600, // TTL 3600, // TTL
) )
.await .await
@ -1409,7 +1409,7 @@ mod tests {
let test_db = TestDb::new().await; let test_db = TestDb::new().await;
let db = test_db.connection(); let db = test_db.connection();
let token = issue_access_token(&db, "test_subject", "test_client_id", "openid profile", let token = issue_access_token(&db, "test_client_id", "test_subject", "openid profile",
3600, // TTL 3600, // TTL
) )
.await .await