Skip to content

Commit

Permalink
refactor: [torrust#56] rename mod and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Nov 30, 2022
1 parent f0f581f commit cd95987
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions tests/upgrades/from_v1_0_0_to_v2_0_0/testers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod torrent_tester;
pub mod tracker_keys_tester;
pub mod user_data_tester;
pub mod tracker_key_tester;
pub mod user_tester;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::upgrades::from_v1_0_0_to_v2_0_0::sqlite_v2_0_0::SqliteDatabaseV2_0_0;
use std::sync::Arc;
use torrust_index_backend::upgrades::from_v1_0_0_to_v2_0_0::databases::sqlite_v1_0_0::TrackerKeyRecordV1;

pub struct TrackerKeysTester {
pub struct TrackerKeyTester {
source_database: Arc<SqliteDatabaseV1_0_0>,
destiny_database: Arc<SqliteDatabaseV2_0_0>,
test_data: TestData,
Expand All @@ -13,7 +13,7 @@ pub struct TestData {
pub tracker_key: TrackerKeyRecordV1,
}

impl TrackerKeysTester {
impl TrackerKeyTester {
pub fn new(
source_database: Arc<SqliteDatabaseV1_0_0>,
destiny_database: Arc<SqliteDatabaseV2_0_0>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rand_core::OsRng;
use std::sync::Arc;
use torrust_index_backend::upgrades::from_v1_0_0_to_v2_0_0::databases::sqlite_v1_0_0::UserRecordV1;

pub struct UserDataTester {
pub struct UserTester {
source_database: Arc<SqliteDatabaseV1_0_0>,
destiny_database: Arc<SqliteDatabaseV2_0_0>,
execution_time: String,
Expand All @@ -17,7 +17,7 @@ pub struct TestData {
pub user: UserRecordV1,
}

impl UserDataTester {
impl UserTester {
pub fn new(
source_database: Arc<SqliteDatabaseV1_0_0>,
destiny_database: Arc<SqliteDatabaseV2_0_0>,
Expand Down
20 changes: 10 additions & 10 deletions tests/upgrades/from_v1_0_0_to_v2_0_0/upgrader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
use crate::upgrades::from_v1_0_0_to_v2_0_0::sqlite_v1_0_0::SqliteDatabaseV1_0_0;
use crate::upgrades::from_v1_0_0_to_v2_0_0::sqlite_v2_0_0::SqliteDatabaseV2_0_0;
use crate::upgrades::from_v1_0_0_to_v2_0_0::testers::torrent_tester::TorrentTester;
use crate::upgrades::from_v1_0_0_to_v2_0_0::testers::tracker_keys_tester::TrackerKeysTester;
use crate::upgrades::from_v1_0_0_to_v2_0_0::testers::user_data_tester::UserDataTester;
use crate::upgrades::from_v1_0_0_to_v2_0_0::testers::tracker_key_tester::TrackerKeyTester;
use crate::upgrades::from_v1_0_0_to_v2_0_0::testers::user_tester::UserTester;
use std::fs;
use std::sync::Arc;
use torrust_index_backend::upgrades::from_v1_0_0_to_v2_0_0::upgrader::{
Expand Down Expand Up @@ -46,24 +46,24 @@ async fn upgrades_data_from_version_v1_0_0_to_v2_0_0() {

// Load data into database v1

let user_data_tester = UserDataTester::new(
let user_tester = UserTester::new(
source_database.clone(),
destiny_database.clone(),
&execution_time,
);
user_data_tester.load_data_into_source_db().await;
user_tester.load_data_into_source_db().await;

let tracker_keys_tester = TrackerKeysTester::new(
let tracker_key_tester = TrackerKeyTester::new(
source_database.clone(),
destiny_database.clone(),
user_data_tester.test_data.user.user_id,
user_tester.test_data.user.user_id,
);
tracker_keys_tester.load_data_into_source_db().await;
tracker_key_tester.load_data_into_source_db().await;

let torrent_tester = TorrentTester::new(
source_database.clone(),
destiny_database.clone(),
&user_data_tester.test_data.user,
&user_tester.test_data.user,
);
torrent_tester.load_data_into_source_db().await;

Expand All @@ -77,8 +77,8 @@ async fn upgrades_data_from_version_v1_0_0_to_v2_0_0() {

// Assertions in database v2

user_data_tester.assert().await;
tracker_keys_tester.assert().await;
user_tester.assert().await;
tracker_key_tester.assert().await;
torrent_tester.assert(&upload_path).await;
}

Expand Down

0 comments on commit cd95987

Please sign in to comment.