Skip to content

Commit

Permalink
test: [torrust#264] Added torrent name to list and detail endpoints
Browse files Browse the repository at this point in the history
Added the field name to the TorrentDetails, ListItem structs used in the response
from the API calls (list and detail endpoints) in the tests.

Some minor refactoring was also applied so the code used to test that the torrents info
is retrieve correctly and match the expected result.
  • Loading branch information
MMelchor committed Sep 11, 2023
1 parent f2369b4 commit 7c4b530
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/common/contexts/torrent/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct TorrentIndexInfo {
pub description: String,
pub category: String,
pub torrent_file: BinaryFile,
pub name: String,
}

impl From<TorrentIndexInfo> for UploadTorrentMultipartForm {
Expand Down Expand Up @@ -84,6 +85,7 @@ impl TestTorrent {
description: format!("description-{id}"),
category: software_predefined_category_name(),
torrent_file,
name: format!("name-{id}"),
};

TestTorrent {
Expand Down
2 changes: 2 additions & 0 deletions tests/common/contexts/torrent/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct ListItem {
pub file_size: i64,
pub seeders: i64,
pub leechers: i64,
pub name: String,
}

#[derive(Deserialize, PartialEq, Debug)]
Expand All @@ -60,6 +61,7 @@ pub struct TorrentDetails {
pub files: Vec<File>,
pub trackers: Vec<String>,
pub magnet_link: String,
pub name: String,
}

#[derive(Deserialize, PartialEq, Debug)]
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/web/api/v1/contexts/torrent/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ mod for_guests {
encoded_tracker_url,
encoded_tracker_url
),
name: test_torrent.index_info.name.clone(),
};

assert_expected_torrent_details(&torrent_details_response.data, &expected_torrent);
Expand Down

0 comments on commit 7c4b530

Please sign in to comment.