feat: fix tests

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-10-22 22:44:12 +02:00
parent ec3ed89d68
commit b3f68c60c7
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
4 changed files with 2 additions and 23 deletions

View File

@ -43,11 +43,9 @@ mod test {
options: AuthClap {
engine: AuthEngine::Noop,
zitadel: ZitadelClap {
auth_url: None,
client_id: None,
client_secret: None,
redirect_url: None,
token_url: None,
authority_url: None,
},
session_backend: SessionBackend::InMemory,
@ -69,11 +67,9 @@ mod test {
options: AuthClap {
engine: AuthEngine::Noop,
zitadel: ZitadelClap {
auth_url: None,
client_id: None,
client_secret: None,
redirect_url: None,
token_url: None,
authority_url: None,
},
session_backend: SessionBackend::InMemory,
@ -105,11 +101,9 @@ mod test {
options: AuthClap {
engine: AuthEngine::Zitadel,
zitadel: ZitadelClap {
auth_url: Some("https://something".into()),
client_id: Some("something".into()),
client_secret: Some("something".into()),
redirect_url: Some("https://something".into()),
token_url: Some("https://something".into()),
authority_url: Some("https://something".into()),
},
session_backend: SessionBackend::InMemory,

View File

@ -73,9 +73,7 @@ mod tests {
"base",
"--zitadel-client-id=something",
"--zitadel-client-secret=something",
"--zitadel-auth-url=https://something",
"--zitadel-redirect-url=https://something",
"--zitadel-token-url=https://something",
"--zitadel-authority-url=https://something",
]);
println!("{:?}", cli.options);
@ -83,11 +81,9 @@ mod tests {
pretty_assertions::assert_eq!(
cli.options,
ZitadelClap {
auth_url: Some("https://something".into()),
client_id: Some("something".into()),
client_secret: Some("something".into()),
redirect_url: Some("https://something".into()),
token_url: Some("https://something".into()),
authority_url: Some("https://something".into()),
}
);
@ -100,9 +96,7 @@ mod tests {
"one",
// "--zitadel-client-id=something", // We want to trigger missing variable
"--zitadel-client-secret=something",
"--zitadel-auth-url=https://something",
"--zitadel-redirect-url=https://something",
"--zitadel-token-url=https://something",
"--zitadel-authority-url=https://something",
]);
@ -113,9 +107,7 @@ mod tests {
fn test_parse_clap_env_zitadel() {
std::env::set_var("ZITADEL_CLIENT_ID", "something");
std::env::set_var("ZITADEL_CLIENT_SECRET", "something");
std::env::set_var("ZITADEL_AUTH_URL", "https://something");
std::env::set_var("ZITADEL_REDIRECT_URL", "https://something");
std::env::set_var("ZITADEL_TOKEN_URL", "https://something");
std::env::set_var("ZITADEL_AUTHORITY_URL", "https://something");
let cli = CliSubCommand::parse_from(["base", "one"]);
@ -124,11 +116,9 @@ mod tests {
cli.command,
Commands::One {
options: ZitadelClap {
auth_url: Some("https://something".into()),
client_id: Some("something".into()),
client_secret: Some("something".into()),
redirect_url: Some("https://something".into()),
token_url: Some("https://something".into()),
authority_url: Some("https://something".into()),
}
}
@ -142,11 +132,9 @@ mod tests {
cli.command,
Commands::One {
options: ZitadelClap {
auth_url: None,
client_id: None,
client_secret: None,
redirect_url: None,
token_url: None,
authority_url: None,
},
}

View File

@ -9,13 +9,11 @@ use axum::{
use nefarious_login::{
auth::AuthService,
axum::{AuthController, UserFromSession},
introspection::IntrospectionService,
login::{
config::{AuthEngine, ZitadelClap},
AuthClap,
},
oauth::OAuth,
session::{PostgresqlSessionClap, SessionBackend, SessionService},
session::{PostgresqlSessionClap, SessionBackend},
};
use tracing_subscriber::EnvFilter;
@ -48,7 +46,7 @@ async fn main() -> anyhow::Result<()> {
},
};
let auth_service = AuthService::new(&auth);
let auth_service = AuthService::new(&auth).await?;
let state = AppState {
auth: auth_service.clone(),

View File

@ -11,7 +11,6 @@ use nefarious_login::{
auth::AuthService,
axum::{AuthController, UserFromSession},
login::AuthClap,
session::SessionService,
};
use tracing_subscriber::EnvFilter;