Skip to content

Commit

Permalink
test: new test for admin users to download a torrent searching by inf…
Browse files Browse the repository at this point in the history
…o hash
  • Loading branch information
mario-nt committed Oct 26, 2024
1 parent f5c0eb8 commit 5783556
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/e2e/web/api/v1/contexts/torrent/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,31 @@ mod and_admins {

let response = client.delete_torrent(&test_torrent.file_info_hash()).await;

assert_eq!(response.status, 200);
}
#[tokio::test]
async fn it_should_allow_admin_users_to_download_a_torrent_file_searching_by_info_hash() {
let mut env = TestEnv::new();
env.start(api::Version::V1).await;

if !env.provides_a_tracker() {
println!("test skipped. It requires a tracker to be running.");
return;
}

let uploader = new_logged_in_user(&env).await;

// Upload
let (test_torrent, _torrent_listed_in_index) = upload_random_torrent_to_index(&uploader, &env).await;

// Download

let admin = new_logged_in_admin(&env).await;

let client = Client::authenticated(&env.server_socket_addr().unwrap(), &admin.token);

let response = client.download_torrent(&test_torrent.file_info_hash()).await;

assert_eq!(response.status, 200);
}
}
Expand Down

0 comments on commit 5783556

Please sign in to comment.