From 7c4b530c5ab39a591ef0a61a2fc1f94dec25e3f0 Mon Sep 17 00:00:00 2001 From: MMelchor Date: Mon, 11 Sep 2023 14:06:21 +0200 Subject: [PATCH] test: [#264] Added torrent name to list and detail endpoints 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. --- tests/common/contexts/torrent/fixtures.rs | 2 ++ tests/common/contexts/torrent/responses.rs | 2 ++ tests/e2e/web/api/v1/contexts/torrent/contract.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/tests/common/contexts/torrent/fixtures.rs b/tests/common/contexts/torrent/fixtures.rs index e4ce70f1..a464651f 100644 --- a/tests/common/contexts/torrent/fixtures.rs +++ b/tests/common/contexts/torrent/fixtures.rs @@ -18,6 +18,7 @@ pub struct TorrentIndexInfo { pub description: String, pub category: String, pub torrent_file: BinaryFile, + pub name: String, } impl From for UploadTorrentMultipartForm { @@ -84,6 +85,7 @@ impl TestTorrent { description: format!("description-{id}"), category: software_predefined_category_name(), torrent_file, + name: format!("name-{id}"), }; TestTorrent { diff --git a/tests/common/contexts/torrent/responses.rs b/tests/common/contexts/torrent/responses.rs index 29da0d45..001784d2 100644 --- a/tests/common/contexts/torrent/responses.rs +++ b/tests/common/contexts/torrent/responses.rs @@ -38,6 +38,7 @@ pub struct ListItem { pub file_size: i64, pub seeders: i64, pub leechers: i64, + pub name: String, } #[derive(Deserialize, PartialEq, Debug)] @@ -60,6 +61,7 @@ pub struct TorrentDetails { pub files: Vec, pub trackers: Vec, pub magnet_link: String, + pub name: String, } #[derive(Deserialize, PartialEq, Debug)] diff --git a/tests/e2e/web/api/v1/contexts/torrent/contract.rs b/tests/e2e/web/api/v1/contexts/torrent/contract.rs index 73d47ed8..9ddd5c33 100644 --- a/tests/e2e/web/api/v1/contexts/torrent/contract.rs +++ b/tests/e2e/web/api/v1/contexts/torrent/contract.rs @@ -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);