Skip to content

Commit

Permalink
test: new test for admin users to get torrent details by canonical in…
Browse files Browse the repository at this point in the history
…fo hash
  • Loading branch information
mario-nt committed Oct 11, 2024
1 parent 56f9468 commit 350fece
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/e2e/web/api/v1/contexts/torrent/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,32 @@ mod and_admins {

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

assert_eq!(response.status, 200);
}
#[tokio::test]
async fn it_should_allow_admin_users_to_get_torrent_details_searching_by_canonical_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 admin = new_logged_in_admin(&env).await;

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

let uploader = new_logged_in_user(&env).await;

let upload_client = Client::authenticated(&env.server_socket_addr().unwrap(), &uploader.token);

let test_torrent = random_torrent();

let canonical_infohash = upload_test_torrent(&upload_client, &test_torrent).await.unwrap().to_string();

let response = client.get_torrent(&canonical_infohash).await;

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

0 comments on commit 350fece

Please sign in to comment.