Skip to content

tests: add integration tests for auth flow in api/src/users.rs #96

@MrSheerluck

Description

@MrSheerluck

Goal

Add integration tests for the auth handlers (signup, signin, change_password, status) in api/src/users.rs using in-memory SQLite.

File to edit

api/src/users.rs

Setup helper

#[cfg(test)]
mod tests {
    use super::*;
    use axum::{extract::State, Json};
    use axum_extra::extract::cookie::CookieJar;
    use sqlx::SqlitePool;

    async fn setup_db() -> SqlitePool {
        let pool = SqlitePool::connect("sqlite::memory:").await.unwrap();
        sqlx::migrate!("../migrations").run(&pool).await.unwrap();
        pool
    }

    fn app_state(pool: SqlitePool) -> crate::AppState {
        crate::AppState { db: pool, client: None, bucket: None }
    }
}

How to run

cd api && cargo test users

Sub-issues (pick one)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions