File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
tests/e2e/web/api/v1/contexts/torrent Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1042,6 +1042,28 @@ mod for_authenticated_users {
10421042 assert_eq ! ( response. status, 200 ) ;
10431043 }
10441044
1045+ #[ tokio:: test]
1046+ async fn it_should_not_allow_registered_users_to_delete_torrents ( ) {
1047+ let mut env = TestEnv :: new ( ) ;
1048+ env. start ( api:: Version :: V1 ) . await ;
1049+
1050+ if !env. provides_a_tracker ( ) {
1051+ println ! ( "test skipped. It requires a tracker to be running." ) ;
1052+ return ;
1053+ }
1054+
1055+ let uploader = new_logged_in_user ( & env) . await ;
1056+ let ( test_torrent, _uploaded_torrent) = upload_random_torrent_to_index ( & uploader, & env) . await ;
1057+
1058+ let registered_user = new_logged_in_user ( & env) . await ;
1059+
1060+ let client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & registered_user. token ) ;
1061+
1062+ let response = client. delete_torrent ( & test_torrent. file_info_hash ( ) ) . await ;
1063+
1064+ assert_eq ! ( response. status, 403 ) ;
1065+ }
1066+
10451067 #[ tokio:: test]
10461068 async fn it_should_allow_registered_users_to_download_a_torrent_file_searching_by_info_hash ( ) {
10471069 let mut env = TestEnv :: new ( ) ;
You can’t perform that action at this time.
0 commit comments