mod common; use axum::body::Body; use axum::http::{Request, StatusCode}; use tower::ServiceExt; use sshca::server::make_app; use common::setup; #[tokio::test] async fn test_oidc_config() { let (_ctx, config) = setup::setup().await.unwrap(); let app = make_app(config); let res = app .oneshot( Request::builder() .uri("/user/oidc-config") .method("GET") .body(Body::empty()) .unwrap(), ) .await .unwrap(); assert_eq!(res.status(), StatusCode::OK); let body = hyper::body::to_bytes(res.into_body()).await.unwrap(); let result: serde_json::Value = serde_json::from_str(std::str::from_utf8(&body).unwrap()).unwrap(); assert_eq!(result["url"].as_str(), Some("https://auth.example.org")); assert_eq!(result["client_id"].as_str(), Some("sshca")); assert_eq!(result["client_secret"].as_str(), None); }