Skip to content

Commit e3baeda

Browse files
committed
test: new authorization test for guests to download a torrent file searching by info hash
1 parent 6df7a7e commit e3baeda

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/e2e/web/api/v1/contexts/torrent/contract.rs

+22
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,28 @@ mod for_guests {
473473

474474
assert_eq!(response.status, 401);
475475
}
476+
477+
#[tokio::test]
478+
async fn it_should_allow_guests_to_download_a_torrent_file_searching_by_info_hash() {
479+
let mut env = TestEnv::new();
480+
env.start(api::Version::V1).await;
481+
482+
if !env.provides_a_tracker() {
483+
println!("test skipped. It requires a tracker to be running.");
484+
return;
485+
}
486+
487+
let client = Client::unauthenticated(&env.server_socket_addr().unwrap());
488+
let uploader = new_logged_in_user(&env).await;
489+
490+
// Upload
491+
let (test_torrent, _torrent_listed_in_index) = upload_random_torrent_to_index(&uploader, &env).await;
492+
493+
// Download
494+
let response = client.download_torrent(&test_torrent.file_info_hash()).await;
495+
496+
assert_eq!(response.status, 200);
497+
}
476498
}
477499
}
478500

0 commit comments

Comments
 (0)