File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
tests/e2e/web/api/v1/contexts/torrent Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1009,6 +1009,38 @@ mod for_authenticated_users {
10091009
10101010 assert_eq ! ( response. status, 403 ) ;
10111011 }
1012+ mod authorization {
1013+ use torrust_index:: web:: api;
1014+
1015+ use crate :: common:: client:: Client ;
1016+ use crate :: common:: contexts:: torrent:: fixtures:: random_torrent;
1017+ use crate :: common:: contexts:: torrent:: forms:: UploadTorrentMultipartForm ;
1018+ use crate :: e2e:: environment:: TestEnv ;
1019+ use crate :: e2e:: web:: api:: v1:: contexts:: user:: steps:: new_logged_in_user;
1020+
1021+ #[ tokio:: test]
1022+ async fn it_should_allow_registered_users_to_upload_torrents ( ) {
1023+ let mut env = TestEnv :: new ( ) ;
1024+ env. start ( api:: Version :: V1 ) . await ;
1025+
1026+ if !env. provides_a_tracker ( ) {
1027+ println ! ( "test skipped. It requires a tracker to be running." ) ;
1028+ return ;
1029+ }
1030+
1031+ let registered_user = new_logged_in_user ( & env) . await ;
1032+
1033+ let client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & registered_user. token ) ;
1034+
1035+ let test_torrent = random_torrent ( ) ;
1036+
1037+ let form: UploadTorrentMultipartForm = test_torrent. index_info . into ( ) ;
1038+
1039+ let response = client. upload_torrent ( form. into ( ) ) . await ;
1040+
1041+ assert_eq ! ( response. status, 200 ) ;
1042+ }
1043+ }
10121044 }
10131045
10141046 mod and_torrent_owners {
You can’t perform that action at this time.
0 commit comments