@@ -1015,6 +1015,8 @@ mod for_authenticated_users {
1015
1015
use crate :: common:: client:: Client ;
1016
1016
use crate :: common:: contexts:: torrent:: fixtures:: random_torrent;
1017
1017
use crate :: common:: contexts:: torrent:: forms:: UploadTorrentMultipartForm ;
1018
+ use crate :: common:: contexts:: torrent:: responses:: TorrentListResponse ;
1019
+ use crate :: common:: http:: Query ;
1018
1020
use crate :: e2e:: environment:: TestEnv ;
1019
1021
use crate :: e2e:: web:: api:: v1:: contexts:: torrent:: steps:: { upload_random_torrent_to_index, upload_test_torrent} ;
1020
1022
use crate :: e2e:: web:: api:: v1:: contexts:: user:: steps:: new_logged_in_user;
@@ -1118,6 +1120,27 @@ mod for_authenticated_users {
1118
1120
1119
1121
assert_eq ! ( response. status, 200 ) ;
1120
1122
}
1123
+
1124
+ #[ tokio:: test]
1125
+ async fn it_should_allow_registered_users_to_get_torrents ( ) {
1126
+ let mut env = TestEnv :: new ( ) ;
1127
+ env. start ( api:: Version :: V1 ) . await ;
1128
+
1129
+ let registered_user = new_logged_in_user ( & env) . await ;
1130
+
1131
+ let client = Client :: authenticated ( & env. server_socket_addr ( ) . unwrap ( ) , & registered_user. token ) ;
1132
+
1133
+ let uploader = new_logged_in_user ( & env) . await ;
1134
+
1135
+ let ( _test_torrent, _indexed_torrent) = upload_random_torrent_to_index ( & uploader, & env) . await ;
1136
+
1137
+ let response = client. get_torrents ( Query :: empty ( ) ) . await ;
1138
+
1139
+ let torrent_list_response: TorrentListResponse = serde_json:: from_str ( & response. body ) . unwrap ( ) ;
1140
+
1141
+ assert ! ( torrent_list_response. data. total > 0 ) ;
1142
+ assert ! ( response. is_json_and_ok( ) ) ;
1143
+ }
1121
1144
}
1122
1145
}
1123
1146
0 commit comments