File tree 1 file changed +30
-1
lines changed
tests/e2e/web/api/v1/contexts/torrent
1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -1366,7 +1366,10 @@ mod and_admins {
1366
1366
use crate :: {
1367
1367
common:: {
1368
1368
client:: Client ,
1369
- contexts:: torrent:: { fixtures:: random_torrent, forms:: UploadTorrentMultipartForm } ,
1369
+ contexts:: torrent:: {
1370
+ fixtures:: random_torrent, forms:: UploadTorrentMultipartForm , responses:: TorrentListResponse ,
1371
+ } ,
1372
+ http:: Query ,
1370
1373
} ,
1371
1374
e2e:: {
1372
1375
environment:: TestEnv ,
@@ -1475,5 +1478,31 @@ mod and_admins {
1475
1478
1476
1479
assert_eq ! ( response. status, 200 ) ;
1477
1480
}
1481
+
1482
+ #[ tokio:: test]
1483
+ async fn it_should_allow_admin_users_to_get_torrents ( ) {
1484
+ let mut env = TestEnv :: new ( ) ;
1485
+ env. start ( api:: Version :: V1 ) . await ;
1486
+
1487
+ if !env. provides_a_tracker ( ) {
1488
+ println ! ( "test skipped. It requires a tracker to be running." ) ;
1489
+ return ;
1490
+ }
1491
+
1492
+ let admin = new_logged_in_admin ( & env) . await ;
1493
+
1494
+ let client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & admin. token ) ;
1495
+
1496
+ let uploader = new_logged_in_user ( & env) . await ;
1497
+
1498
+ let ( _test_torrent, _indexed_torrent) = upload_random_torrent_to_index ( & uploader, & env) . await ;
1499
+
1500
+ let response = client. get_torrents ( Query :: empty ( ) ) . await ;
1501
+
1502
+ let torrent_list_response: TorrentListResponse = serde_json:: from_str ( & response. body ) . unwrap ( ) ;
1503
+
1504
+ assert ! ( torrent_list_response. data. total > 0 ) ;
1505
+ assert ! ( response. is_json_and_ok( ) ) ;
1506
+ }
1478
1507
}
1479
1508
}
You can’t perform that action at this time.
0 commit comments