Skip to content

Commit

Permalink
Remove dead code warnings for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qutax committed Apr 20, 2023
1 parent afd095f commit 8f3e99e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion backend/src/repository/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::core::repository::PaymentRepository;
use crate::schema;
use diesel::prelude::*;
use diesel::r2d2::ConnectionManager;
use diesel::{sql_types, PgConnection, RunQueryDsl};
use diesel::{PgConnection, RunQueryDsl};
use r2d2::Pool;

pub struct PostgresPaymentRepository {
Expand Down
6 changes: 2 additions & 4 deletions backend/tests/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use pace::models::users::{LoginData, PasswordChangeData};
use pace::{insert_rejected_transaction, models::rejected_transaction::NewRejectedTransaction};
use std::collections::HashMap;

mod helpers;
use crate::helpers::{TestApp, TestDatabase};
pub mod helpers;
pub use helpers::{TestApp, TestDatabase};

#[test]
fn put_rejected_transaction_into_database() {
Expand Down Expand Up @@ -263,7 +263,6 @@ async fn delete_rejected_transactions_should_fail_if_user_is_unauthorized() {
let docker = testcontainers::clients::Cli::default();
let test_app = TestApp::new(&docker).await;

let ids = "[1, 2]";
let result = test_app
.delete_rejected_transactions("[1, 2]".to_string(), None)
.await;
Expand Down Expand Up @@ -293,7 +292,6 @@ async fn delete_rejected_transactions_should_be_successful_if_authenticated() {

let cookie = test_app.get_admin_cookie().await;

let ids = "[1, 2]";
let result = test_app
.delete_rejected_transactions("[1, 2]".to_string(), Some(cookie))
.await;
Expand Down
1 change: 0 additions & 1 deletion backend/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use diesel::{pg::Pg, PgConnection};
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
use pace::handlers::theme::ThemeData;
use r2d2::{Pool, PooledConnection};
use reqwest::cookie::Cookie;
use reqwest::{Client, Response};
use serde_json::Map;
use std::env;
Expand Down
3 changes: 2 additions & 1 deletion backend/tests/repository/payment.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::helpers::TestDatabase;
use diesel::RunQueryDsl;
use pace::core::repository::PaymentRepository;
use pace::repository::PostgresPaymentRepository;

pub use crate::helpers::TestDatabase;

#[test]
fn deleted_rejected_transactions_by_ids_should_delete_all_relevant_entries() {
let cli = testcontainers::clients::Cli::default();
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/repository/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use pace::models::runner::{NewRunner, Runner};
use pace::repository::PostgresRunnerRepository;
use pace::schema::runners;

use crate::helpers::TestDatabase;
pub use crate::helpers::TestDatabase;

#[test]
fn insert_runner_should_store_runner_in_db_if_no_constraints_are_violated() {
Expand Down
3 changes: 1 addition & 2 deletions backend/tests/repository/user.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use diesel::RunQueryDsl;
use pace::core::repository::UserRepository;
use pace::models::users::User;
use pace::repository::PostgresUserRepository;

use crate::helpers::TestDatabase;
pub use crate::helpers::TestDatabase;

#[test]
fn find_user_by_username_should_return_user_with_given_username_if_present_in_db() {
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/runners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use pace::handlers::runners::{
};
use pace::models::runner::create_verification_code;

mod helpers;
use crate::helpers::{extract_json_values, TestApp};
pub mod helpers;
pub use crate::helpers::{extract_json_values, TestApp};

#[actix_web::test]
async fn create_runner_should_be_successful_if_only_participant_info_is_provided<'a>() {
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/start_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use diesel::PgConnection;
use pace::constants::DENYLIST_START_NUMBERS;
use pace::models::start_number::next_start_number;

mod helpers;
use crate::helpers::TestDatabase;
pub mod helpers;
pub use crate::helpers::TestDatabase;

// For testing only
fn restart_start_number(conn: &mut PgConnection) {
Expand Down
5 changes: 3 additions & 2 deletions backend/tests/theme.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use pace::handlers::theme::ThemeData;
use reqwest::StatusCode;
mod helpers;
use crate::helpers::{extract_json_values, TestApp};

pub mod helpers;
pub use crate::helpers::{extract_json_values, TestApp};

#[actix_web::test]
async fn get_theme_should_return_theme_settings() {
Expand Down

0 comments on commit 8f3e99e

Please sign in to comment.