strip session-added comments
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
//! Shared helpers for the bootstrap integration tests: a production app built
|
||||
//! through `bootstrap` on an in-memory database, driven over HTTP.
|
||||
#![allow(dead_code)]
|
||||
|
||||
use axum::{
|
||||
@@ -29,7 +27,6 @@ pub fn test_config() -> config::AppConfig {
|
||||
nats: Default::default(),
|
||||
storage: Default::default(),
|
||||
image_conversion: Default::default(),
|
||||
// Required to build; never called (seeding logs reviews with manual titles).
|
||||
metadata: config::MetadataConfig {
|
||||
tmdb_api_key: Some("test-key".into()),
|
||||
..Default::default()
|
||||
@@ -94,7 +91,6 @@ pub fn json_request(
|
||||
b.body(Body::from(body.to_string())).unwrap()
|
||||
}
|
||||
|
||||
/// A single-connection in-memory pool (every connection would otherwise get its own database).
|
||||
pub async fn memory_pool() -> sqlx::SqlitePool {
|
||||
sqlx::sqlite::SqlitePoolOptions::new()
|
||||
.max_connections(1)
|
||||
@@ -103,7 +99,6 @@ pub async fn memory_pool() -> sqlx::SqlitePool {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// The production server router on a fresh in-memory database, plus its pool.
|
||||
pub async fn server() -> (Router, sqlx::SqlitePool) {
|
||||
let pool = memory_pool().await;
|
||||
let router = bootstrap::build_server_on(&test_config(), pool.clone())
|
||||
@@ -114,14 +109,10 @@ pub async fn server() -> (Router, sqlx::SqlitePool) {
|
||||
|
||||
pub struct Session {
|
||||
pub user_id: String,
|
||||
/// Bearer token for the JSON API.
|
||||
pub token: String,
|
||||
/// Cookie header for the classic UI (csrf + session).
|
||||
pub cookie: String,
|
||||
}
|
||||
|
||||
/// Registers through the classic form (GET for the csrf cookie, then POST with
|
||||
/// the token), then logs in over the JSON API for a bearer token.
|
||||
pub async fn register(router: &Router, username: &str, email: &str) -> Session {
|
||||
let (status, headers, _) = send(router, get("/register", None)).await;
|
||||
assert_eq!(status, 200, "GET /register");
|
||||
|
||||
Reference in New Issue
Block a user