diff options
Diffstat (limited to 'crates/auth/src/server/routes.rs')
-rw-r--r-- | crates/auth/src/server/routes.rs | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/crates/auth/src/server/routes.rs b/crates/auth/src/server/routes.rs deleted file mode 100644 index 6773962..0000000 --- a/crates/auth/src/server/routes.rs +++ /dev/null @@ -1,62 +0,0 @@ -pub mod authorised; -pub mod discord; - -use std::fmt::Display; - -use axum::response::IntoResponse; -use serde::Deserialize; - -#[derive(Debug, Clone, Copy, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum Provider { - Discord, -} - -impl Display for Provider { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}", - match self { - Provider::Discord => "discord", - } - ) - } -} - -pub async fn health_check() -> impl IntoResponse { - let name = env!("CARGO_PKG_NAME"); - let ver = env!("CARGO_PKG_VERSION"); - - format!("{name} v{ver} is live") -} - -#[cfg(test)] -mod tests { - use axum::{ - body::Body, - http::{Request, StatusCode}, - }; - use sqlx::PgPool; - use stack_up::Services; - use tower::ServiceExt; - - use crate::{ - server::{self, test_config}, - state::AppState, - }; - - #[sqlx::test] - async fn health_check(pool: PgPool) { - let services = Services { postgres: pool }; - let (state, _) = AppState::create(services, &test_config()).await.unwrap(); - let app = server::router(state); - - let response = app - .oneshot(Request::builder().uri("/").body(Body::empty()).unwrap()) - .await - .unwrap(); - - assert_eq!(response.status(), StatusCode::OK); - } -} |