@@ -414,7 +414,7 @@ mod for_guests {
414
414
use crate :: common:: contexts:: torrent:: responses:: TorrentListResponse ;
415
415
use crate :: common:: http:: Query ;
416
416
use crate :: e2e:: environment:: TestEnv ;
417
- use crate :: e2e:: web:: api:: v1:: contexts:: torrent:: steps:: upload_random_torrent_to_index;
417
+ use crate :: e2e:: web:: api:: v1:: contexts:: torrent:: steps:: { upload_random_torrent_to_index, upload_test_torrent } ;
418
418
use crate :: e2e:: web:: api:: v1:: contexts:: user:: steps:: new_logged_in_user;
419
419
420
420
#[ tokio:: test]
@@ -475,6 +475,33 @@ mod for_guests {
475
475
assert_eq ! ( response. status, 200 ) ;
476
476
}
477
477
478
+ #[ tokio:: test]
479
+ async fn it_should_allow_guests_to_download_a_torrent_file_searching_by_canonical_info_hash ( ) {
480
+ let mut env = TestEnv :: new ( ) ;
481
+ env. start ( api:: Version :: V1 ) . await ;
482
+
483
+ if !env. provides_a_tracker ( ) {
484
+ println ! ( "test skipped. It requires a tracker to be running." ) ;
485
+ return ;
486
+ }
487
+
488
+ let download_client = Client :: unauthenticated ( & env. server_socket_addr ( ) . unwrap ( ) ) ;
489
+
490
+ let uploader = new_logged_in_user ( & env) . await ;
491
+
492
+ let upload_client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & uploader. token ) ;
493
+
494
+ // Upload
495
+ let test_torrent = random_torrent ( ) ;
496
+
497
+ let canonical_infohash = upload_test_torrent ( & upload_client, & test_torrent) . await . unwrap ( ) . to_string ( ) ;
498
+
499
+ // Download
500
+ let response = download_client. download_torrent ( & canonical_infohash) . await ;
501
+
502
+ assert_eq ! ( response. status, 200 ) ;
503
+ }
504
+
478
505
#[ tokio:: test]
479
506
async fn it_should_allow_guests_to_get_torrents ( ) {
480
507
let mut env = TestEnv :: new ( ) ;
0 commit comments