feat: fix tests
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
ec3ed89d68
commit
b3f68c60c7
@ -43,11 +43,9 @@ mod test {
|
|||||||
options: AuthClap {
|
options: AuthClap {
|
||||||
engine: AuthEngine::Noop,
|
engine: AuthEngine::Noop,
|
||||||
zitadel: ZitadelClap {
|
zitadel: ZitadelClap {
|
||||||
auth_url: None,
|
|
||||||
client_id: None,
|
client_id: None,
|
||||||
client_secret: None,
|
client_secret: None,
|
||||||
redirect_url: None,
|
redirect_url: None,
|
||||||
token_url: None,
|
|
||||||
authority_url: None,
|
authority_url: None,
|
||||||
},
|
},
|
||||||
session_backend: SessionBackend::InMemory,
|
session_backend: SessionBackend::InMemory,
|
||||||
@ -69,11 +67,9 @@ mod test {
|
|||||||
options: AuthClap {
|
options: AuthClap {
|
||||||
engine: AuthEngine::Noop,
|
engine: AuthEngine::Noop,
|
||||||
zitadel: ZitadelClap {
|
zitadel: ZitadelClap {
|
||||||
auth_url: None,
|
|
||||||
client_id: None,
|
client_id: None,
|
||||||
client_secret: None,
|
client_secret: None,
|
||||||
redirect_url: None,
|
redirect_url: None,
|
||||||
token_url: None,
|
|
||||||
authority_url: None,
|
authority_url: None,
|
||||||
},
|
},
|
||||||
session_backend: SessionBackend::InMemory,
|
session_backend: SessionBackend::InMemory,
|
||||||
@ -105,11 +101,9 @@ mod test {
|
|||||||
options: AuthClap {
|
options: AuthClap {
|
||||||
engine: AuthEngine::Zitadel,
|
engine: AuthEngine::Zitadel,
|
||||||
zitadel: ZitadelClap {
|
zitadel: ZitadelClap {
|
||||||
auth_url: Some("https://something".into()),
|
|
||||||
client_id: Some("something".into()),
|
client_id: Some("something".into()),
|
||||||
client_secret: Some("something".into()),
|
client_secret: Some("something".into()),
|
||||||
redirect_url: Some("https://something".into()),
|
redirect_url: Some("https://something".into()),
|
||||||
token_url: Some("https://something".into()),
|
|
||||||
authority_url: Some("https://something".into()),
|
authority_url: Some("https://something".into()),
|
||||||
},
|
},
|
||||||
session_backend: SessionBackend::InMemory,
|
session_backend: SessionBackend::InMemory,
|
||||||
|
@ -73,9 +73,7 @@ mod tests {
|
|||||||
"base",
|
"base",
|
||||||
"--zitadel-client-id=something",
|
"--zitadel-client-id=something",
|
||||||
"--zitadel-client-secret=something",
|
"--zitadel-client-secret=something",
|
||||||
"--zitadel-auth-url=https://something",
|
|
||||||
"--zitadel-redirect-url=https://something",
|
"--zitadel-redirect-url=https://something",
|
||||||
"--zitadel-token-url=https://something",
|
|
||||||
"--zitadel-authority-url=https://something",
|
"--zitadel-authority-url=https://something",
|
||||||
]);
|
]);
|
||||||
println!("{:?}", cli.options);
|
println!("{:?}", cli.options);
|
||||||
@ -83,11 +81,9 @@ mod tests {
|
|||||||
pretty_assertions::assert_eq!(
|
pretty_assertions::assert_eq!(
|
||||||
cli.options,
|
cli.options,
|
||||||
ZitadelClap {
|
ZitadelClap {
|
||||||
auth_url: Some("https://something".into()),
|
|
||||||
client_id: Some("something".into()),
|
client_id: Some("something".into()),
|
||||||
client_secret: Some("something".into()),
|
client_secret: Some("something".into()),
|
||||||
redirect_url: Some("https://something".into()),
|
redirect_url: Some("https://something".into()),
|
||||||
token_url: Some("https://something".into()),
|
|
||||||
authority_url: Some("https://something".into()),
|
authority_url: Some("https://something".into()),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -100,9 +96,7 @@ mod tests {
|
|||||||
"one",
|
"one",
|
||||||
// "--zitadel-client-id=something", // We want to trigger missing variable
|
// "--zitadel-client-id=something", // We want to trigger missing variable
|
||||||
"--zitadel-client-secret=something",
|
"--zitadel-client-secret=something",
|
||||||
"--zitadel-auth-url=https://something",
|
|
||||||
"--zitadel-redirect-url=https://something",
|
"--zitadel-redirect-url=https://something",
|
||||||
"--zitadel-token-url=https://something",
|
|
||||||
"--zitadel-authority-url=https://something",
|
"--zitadel-authority-url=https://something",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -113,9 +107,7 @@ mod tests {
|
|||||||
fn test_parse_clap_env_zitadel() {
|
fn test_parse_clap_env_zitadel() {
|
||||||
std::env::set_var("ZITADEL_CLIENT_ID", "something");
|
std::env::set_var("ZITADEL_CLIENT_ID", "something");
|
||||||
std::env::set_var("ZITADEL_CLIENT_SECRET", "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_REDIRECT_URL", "https://something");
|
||||||
std::env::set_var("ZITADEL_TOKEN_URL", "https://something");
|
|
||||||
std::env::set_var("ZITADEL_AUTHORITY_URL", "https://something");
|
std::env::set_var("ZITADEL_AUTHORITY_URL", "https://something");
|
||||||
|
|
||||||
let cli = CliSubCommand::parse_from(["base", "one"]);
|
let cli = CliSubCommand::parse_from(["base", "one"]);
|
||||||
@ -124,11 +116,9 @@ mod tests {
|
|||||||
cli.command,
|
cli.command,
|
||||||
Commands::One {
|
Commands::One {
|
||||||
options: ZitadelClap {
|
options: ZitadelClap {
|
||||||
auth_url: Some("https://something".into()),
|
|
||||||
client_id: Some("something".into()),
|
client_id: Some("something".into()),
|
||||||
client_secret: Some("something".into()),
|
client_secret: Some("something".into()),
|
||||||
redirect_url: Some("https://something".into()),
|
redirect_url: Some("https://something".into()),
|
||||||
token_url: Some("https://something".into()),
|
|
||||||
authority_url: Some("https://something".into()),
|
authority_url: Some("https://something".into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,11 +132,9 @@ mod tests {
|
|||||||
cli.command,
|
cli.command,
|
||||||
Commands::One {
|
Commands::One {
|
||||||
options: ZitadelClap {
|
options: ZitadelClap {
|
||||||
auth_url: None,
|
|
||||||
client_id: None,
|
client_id: None,
|
||||||
client_secret: None,
|
client_secret: None,
|
||||||
redirect_url: None,
|
redirect_url: None,
|
||||||
token_url: None,
|
|
||||||
authority_url: None,
|
authority_url: None,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,11 @@ use axum::{
|
|||||||
use nefarious_login::{
|
use nefarious_login::{
|
||||||
auth::AuthService,
|
auth::AuthService,
|
||||||
axum::{AuthController, UserFromSession},
|
axum::{AuthController, UserFromSession},
|
||||||
introspection::IntrospectionService,
|
|
||||||
login::{
|
login::{
|
||||||
config::{AuthEngine, ZitadelClap},
|
config::{AuthEngine, ZitadelClap},
|
||||||
AuthClap,
|
AuthClap,
|
||||||
},
|
},
|
||||||
oauth::OAuth,
|
session::{PostgresqlSessionClap, SessionBackend},
|
||||||
session::{PostgresqlSessionClap, SessionBackend, SessionService},
|
|
||||||
};
|
};
|
||||||
use tracing_subscriber::EnvFilter;
|
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 {
|
let state = AppState {
|
||||||
auth: auth_service.clone(),
|
auth: auth_service.clone(),
|
||||||
|
@ -11,7 +11,6 @@ use nefarious_login::{
|
|||||||
auth::AuthService,
|
auth::AuthService,
|
||||||
axum::{AuthController, UserFromSession},
|
axum::{AuthController, UserFromSession},
|
||||||
login::AuthClap,
|
login::AuthClap,
|
||||||
session::SessionService,
|
|
||||||
};
|
};
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user