Skip to content

Commit

Permalink
Revert workaround for broken sqlx::test macro (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
praseodym authored Sep 9, 2024
1 parent aa0dcab commit 99159de
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions backend/src/polling_station/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ mod tests {
}
}

#[sqlx::test(fixtures("../../fixtures/elections.sql", "../../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_valid(pool: SqlitePool) {
let mut request_body = example_data_entry();

Expand Down Expand Up @@ -350,7 +350,7 @@ mod tests {
assert_eq!(row_count.count, 1);
}

#[sqlx::test(fixtures("../../fixtures/elections.sql", "../../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_delete(pool: SqlitePool) {
// create data entry
let response = polling_station_data_entry(
Expand Down
8 changes: 4 additions & 4 deletions backend/tests/data_entries_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use crate::utils::serve_api;
mod shared;
mod utils;

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_valid(pool: SqlitePool) {
let addr = serve_api(pool.clone()).await;
shared::create_and_finalise_data_entry(&addr).await;
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_validation(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand Down Expand Up @@ -157,7 +157,7 @@ async fn test_polling_station_data_entry_invalid(pool: SqlitePool) {
);
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_only_for_existing(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand All @@ -184,7 +184,7 @@ async fn test_polling_station_data_entry_only_for_existing(pool: SqlitePool) {
assert_eq!(response.status(), StatusCode::NOT_FOUND);
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_deletion(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand Down
6 changes: 3 additions & 3 deletions backend/tests/election_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use backend::ErrorResponse;
mod shared;
mod utils;

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_valid(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand Down Expand Up @@ -106,7 +106,7 @@ async fn test_polling_station_data_entry_invalid(pool: SqlitePool) {
);
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_data_entry_validation(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand Down Expand Up @@ -261,7 +261,7 @@ async fn test_election_details_not_found(pool: SqlitePool) {
assert_eq!(status, StatusCode::NOT_FOUND);
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_election_details_status(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand Down
4 changes: 2 additions & 2 deletions backend/tests/polling_station_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::utils::serve_api;

mod utils;

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_listing_works(pool: SqlitePool) {
let addr = serve_api(pool).await;

Expand All @@ -28,7 +28,7 @@ async fn test_polling_station_listing_works(pool: SqlitePool) {
.any(|ps| ps.name == "Stembureau \"Op Rolletjes\""));
}

#[sqlx::test(fixtures("../fixtures/elections.sql", "../fixtures/polling_stations.sql"))]
#[sqlx::test(fixtures(path = "../fixtures", scripts("elections", "polling_stations")))]
async fn test_polling_station_list_invalid_election(pool: SqlitePool) {
let addr = serve_api(pool).await;
// election ID 1234 does not exist
Expand Down

0 comments on commit 99159de

Please sign in to comment.