Update test suite to drop database automatically when test is successfull
This commit is contained in:
@@ -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}");
|
||||
|
||||
Reference in New Issue
Block a user