Skip to content

Commit 9df66e6

Browse files
committed
test: new authorization test for guests getting torrent details searching by canonical info hash
1 parent d7b37fc commit 9df66e6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

+24
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,30 @@ mod for_guests {
542542

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

545+
assert_eq!(response.status, 200);
546+
}
547+
#[tokio::test]
548+
async fn it_should_allow_guests_to_get_torrent_details_searching_by_canonical_info_hash() {
549+
let mut env = TestEnv::new();
550+
env.start(api::Version::V1).await;
551+
552+
if !env.provides_a_tracker() {
553+
println!("test skipped. It requires a tracker to be running.");
554+
return;
555+
}
556+
557+
let client = Client::unauthenticated(&env.server_socket_addr().unwrap());
558+
559+
let uploader = new_logged_in_user(&env).await;
560+
561+
let upload_client = Client::authenticated(&env.server_socket_addr().unwrap(), &uploader.token);
562+
563+
let test_torrent = random_torrent();
564+
565+
let canonical_infohash = upload_test_torrent(&upload_client, &test_torrent).await.unwrap().to_string();
566+
567+
let response = client.get_torrent(&canonical_infohash).await;
568+
545569
assert_eq!(response.status, 200);
546570
}
547571
}

0 commit comments

Comments
 (0)