File tree 1 file changed +33
-0
lines changed
tests/e2e/web/api/v1/contexts/torrent
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1197,6 +1197,39 @@ mod for_authenticated_users {
1197
1197
1198
1198
assert_eq ! ( response. status, 403 ) ;
1199
1199
}
1200
+ #[ tokio:: test]
1201
+ async fn it_should_allow_registered_users_to_update_their_own_torrents ( ) {
1202
+ let mut env = TestEnv :: new ( ) ;
1203
+ env. start ( api:: Version :: V1 ) . await ;
1204
+
1205
+ if !env. provides_a_tracker ( ) {
1206
+ println ! ( "test skipped. It requires a tracker to be running." ) ;
1207
+ return ;
1208
+ }
1209
+
1210
+ // Given a users uploads a torrent
1211
+ let uploader = new_logged_in_user ( & env) . await ;
1212
+ let ( test_torrent, _uploaded_torrent) = upload_random_torrent_to_index ( & uploader, & env) . await ;
1213
+
1214
+ let client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & uploader. token ) ;
1215
+
1216
+ let new_title = format ! ( "{}-new-title" , test_torrent. index_info. title) ;
1217
+ let new_description = format ! ( "{}-new-description" , test_torrent. index_info. description) ;
1218
+
1219
+ let response = client
1220
+ . update_torrent (
1221
+ & test_torrent. file_info_hash ( ) ,
1222
+ UpdateTorrentFrom {
1223
+ title : Some ( new_title. clone ( ) ) ,
1224
+ description : Some ( new_description. clone ( ) ) ,
1225
+ category : None ,
1226
+ tags : None ,
1227
+ } ,
1228
+ )
1229
+ . await ;
1230
+
1231
+ assert_eq ! ( response. status, 200 ) ;
1232
+ }
1200
1233
}
1201
1234
}
1202
1235
}
You can’t perform that action at this time.
0 commit comments