Update test suite to drop database automatically when test is successfull
Some checks failed
Rust / Test (push) Has been cancelled
Rust / Rustfmt (push) Has been cancelled
Rust / Clippy (push) Has been cancelled
Rust / Code coverage (push) Has been cancelled

This commit is contained in:
Alphonse Paix
2025-09-24 02:55:18 +02:00
parent 9ea539e5cc
commit 33281132c6
12 changed files with 128 additions and 148 deletions

View File

@@ -1,9 +1,10 @@
use crate::helpers::{TestApp, when_sending_an_email};
use sqlx::PgPool;
use wiremock::ResponseTemplate;
#[tokio::test]
async fn confirmation_links_without_token_are_rejected_with_a_400() {
let app = TestApp::spawn().await;
#[sqlx::test]
async fn confirmation_links_without_token_are_rejected_with_a_400(connection_pool: PgPool) {
let app = TestApp::spawn(connection_pool).await;
let response = reqwest::get(&format!("{}/subscriptions/confirm", &app.address))
.await
@@ -11,9 +12,9 @@ async fn confirmation_links_without_token_are_rejected_with_a_400() {
assert_eq!(400, response.status().as_u16());
}
#[tokio::test]
async fn clicking_on_the_link_shows_a_confirmation_message() {
let app = TestApp::spawn().await;
#[sqlx::test]
async fn clicking_on_the_link_shows_a_confirmation_message(connection_pool: PgPool) {
let app = TestApp::spawn(connection_pool).await;
let email = "alphonse.paix@outlook.com";
let body = format!("email={email}");
@@ -39,9 +40,9 @@ async fn clicking_on_the_link_shows_a_confirmation_message() {
);
}
#[tokio::test]
async fn clicking_on_the_confirmation_link_confirms_a_subscriber() {
let app = TestApp::spawn().await;
#[sqlx::test]
async fn clicking_on_the_confirmation_link_confirms_a_subscriber(connection_pool: PgPool) {
let app = TestApp::spawn(connection_pool).await;
let email = "alphonse.paix@outlook.com";
let body = format!("email={email}");