Skip to content

Commit

Permalink
refactor: [torrust#56] rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Nov 30, 2022
1 parent 0063289 commit 750969d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl TorrentTester {
.unwrap();
}

pub async fn assert(&self, upload_path: &str) {
pub async fn assert_data_in_destiny_db(&self, upload_path: &str) {
let filepath = self.torrent_file_path(upload_path, self.test_data.torrent.torrent_id);
let torrent_file = read_torrent_from_file(&filepath).unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl TrackerKeyTester {
}

/// Table `torrust_tracker_keys`
pub async fn assert(&self) {
pub async fn assert_data_in_destiny_db(&self) {
let imported_key = self
.destiny_database
.get_tracker_key(self.test_data.tracker_key.key_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl UserTester {
.unwrap();
}

pub async fn assert(&self) {
pub async fn assert_data_in_destiny_db(&self) {
self.assert_user().await;
self.assert_user_profile().await;
self.assert_user_authentication().await;
Expand Down
25 changes: 14 additions & 11 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 @@ -44,7 +44,7 @@ async fn upgrades_data_from_version_v1_0_0_to_v2_0_0() {
// The datetime when the upgrader is executed
let execution_time = datetime_iso_8601();

// Load data into database v1
// Load data into source database in version v1.0.0

let user_tester = UserTester::new(
source_database.clone(),
Expand All @@ -68,18 +68,21 @@ async fn upgrades_data_from_version_v1_0_0_to_v2_0_0() {
torrent_tester.load_data_into_source_db().await;

// Run the upgrader
let args = Arguments {
source_database_file: source_database_file.clone(),
destiny_database_file: destiny_database_file.clone(),
upload_path: upload_path.clone(),
};
upgrade(&args, &execution_time).await;
upgrade(
&Arguments {
source_database_file: source_database_file.clone(),
destiny_database_file: destiny_database_file.clone(),
upload_path: upload_path.clone(),
},
&execution_time,
)
.await;

// Assertions in database v2
// Assertions for data transferred to the new database in version v2.0.0

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

async fn source_db_connection(source_database_file: &str) -> Arc<SqliteDatabaseV1_0_0> {
Expand Down

0 comments on commit 750969d

Please sign in to comment.