forked from torrust/torrust-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [torrust#115] extractfunction expected_torrent
- Loading branch information
1 parent
4782f67
commit e8bf537
Showing
3 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use torrust_index_backend::models::torrent_file::Torrent; | ||
|
||
/// The backend does not generate exactly the same torrent that was uploaded. | ||
/// So we need to update the expected torrent to match the one generated by | ||
/// the backend. | ||
pub fn expected_torrent(mut uploaded_torrent: Torrent) -> Torrent { | ||
// code-review: The backend does not generate exactly the same torrent | ||
// that was uploaded and created by the `imdl` command-line tool. | ||
// So we need to update the expected torrent to match the one generated | ||
// by the backend. For some of them it makes sense (`announce` and `announce_list`), | ||
// for others it does not. | ||
uploaded_torrent.info.private = Some(0); | ||
uploaded_torrent.announce = Some("udp://tracker:6969".to_string()); | ||
uploaded_torrent.encoding = None; | ||
uploaded_torrent.announce_list = Some(vec![vec!["udp://tracker:6969".to_string()]]); | ||
uploaded_torrent.creation_date = None; | ||
uploaded_torrent.created_by = None; | ||
|
||
uploaded_torrent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod asserts; | ||
pub mod contract; | ||
pub mod steps; |