@@ -23,8 +23,7 @@ mod for_guests {
23
23
use crate :: common:: client:: Client ;
24
24
use crate :: common:: contexts:: category:: fixtures:: software_predefined_category_id;
25
25
use crate :: common:: contexts:: torrent:: asserts:: assert_expected_torrent_details;
26
- use crate :: common:: contexts:: torrent:: fixtures:: { random_torrent, TestTorrent } ;
27
- use crate :: common:: contexts:: torrent:: forms:: UploadTorrentMultipartForm ;
26
+ use crate :: common:: contexts:: torrent:: fixtures:: TestTorrent ;
28
27
use crate :: common:: contexts:: torrent:: requests:: InfoHash ;
29
28
use crate :: common:: contexts:: torrent:: responses:: {
30
29
Category , File , TorrentDetails , TorrentDetailsResponse , TorrentListResponse ,
@@ -429,22 +428,6 @@ mod for_guests {
429
428
assert_eq ! ( response. status, 404 ) ;
430
429
}
431
430
432
- #[ tokio:: test]
433
- async fn it_should_not_allow_guests_to_upload_torrents ( ) {
434
- let mut env = TestEnv :: new ( ) ;
435
- env. start ( api:: Version :: V1 ) . await ;
436
-
437
- let client = Client :: unauthenticated ( & env. server_socket_addr ( ) . unwrap ( ) ) ;
438
-
439
- let test_torrent = random_torrent ( ) ;
440
-
441
- let form: UploadTorrentMultipartForm = test_torrent. index_info . into ( ) ;
442
-
443
- let response = client. upload_torrent ( form. into ( ) ) . await ;
444
-
445
- assert_eq ! ( response. status, 401 ) ;
446
- }
447
-
448
431
#[ tokio:: test]
449
432
async fn it_should_not_allow_guests_to_delete_torrents ( ) {
450
433
let mut env = TestEnv :: new ( ) ;
@@ -464,6 +447,31 @@ mod for_guests {
464
447
465
448
assert_eq ! ( response. status, 401 ) ;
466
449
}
450
+
451
+ mod authorization {
452
+ use torrust_index:: web:: api;
453
+
454
+ use crate :: common:: client:: Client ;
455
+ use crate :: common:: contexts:: torrent:: fixtures:: random_torrent;
456
+ use crate :: common:: contexts:: torrent:: forms:: UploadTorrentMultipartForm ;
457
+ use crate :: e2e:: environment:: TestEnv ;
458
+
459
+ #[ tokio:: test]
460
+ async fn it_should_not_allow_guests_to_upload_torrents ( ) {
461
+ let mut env = TestEnv :: new ( ) ;
462
+ env. start ( api:: Version :: V1 ) . await ;
463
+
464
+ let client = Client :: unauthenticated ( & env. server_socket_addr ( ) . unwrap ( ) ) ;
465
+
466
+ let test_torrent = random_torrent ( ) ;
467
+
468
+ let form: UploadTorrentMultipartForm = test_torrent. index_info . into ( ) ;
469
+
470
+ let response = client. upload_torrent ( form. into ( ) ) . await ;
471
+
472
+ assert_eq ! ( response. status, 401 ) ;
473
+ }
474
+ }
467
475
}
468
476
469
477
mod for_authenticated_users {
0 commit comments