@@ -112,29 +112,10 @@ pub async fn get_torrents(
112
112
#[ cfg( test) ]
113
113
mod tests {
114
114
use std:: net:: { IpAddr , Ipv4Addr , SocketAddr } ;
115
- use std:: sync:: Arc ;
116
115
117
116
use aquatic_udp_protocol:: { AnnounceEvent , NumberOfBytes , PeerId } ;
118
- use torrust_tracker_configuration:: Configuration ;
119
117
use torrust_tracker_primitives:: { peer, DurationSinceUnixEpoch } ;
120
118
121
- use crate :: app_test:: initialize_tracker_dependencies;
122
- use crate :: core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
123
-
124
- fn initialize_in_memory_torrent_repository ( config : & Configuration ) -> Arc < InMemoryTorrentRepository > {
125
- let (
126
- _database,
127
- _in_memory_whitelist,
128
- _whitelist_authorization,
129
- _authentication_service,
130
- in_memory_torrent_repository,
131
- _db_torrent_repository,
132
- _torrents_manager,
133
- ) = initialize_tracker_dependencies ( config) ;
134
-
135
- in_memory_torrent_repository
136
- }
137
-
138
119
fn sample_peer ( ) -> peer:: Peer {
139
120
peer:: Peer {
140
121
peer_id : PeerId ( * b"-qB00000000000000000" ) ,
@@ -153,17 +134,11 @@ mod tests {
153
134
use std:: sync:: Arc ;
154
135
155
136
use bittorrent_primitives:: info_hash:: InfoHash ;
156
- use torrust_tracker_configuration:: Configuration ;
157
- use torrust_tracker_test_helpers:: configuration;
158
137
159
- use crate :: core:: services:: torrent:: tests:: { initialize_in_memory_torrent_repository , sample_peer} ;
138
+ use crate :: core:: services:: torrent:: tests:: sample_peer;
160
139
use crate :: core:: services:: torrent:: { get_torrent_info, Info } ;
161
140
use crate :: core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
162
141
163
- pub fn tracker_configuration ( ) -> Configuration {
164
- configuration:: ephemeral ( )
165
- }
166
-
167
142
#[ tokio:: test]
168
143
async fn should_return_none_if_the_tracker_does_not_have_the_torrent ( ) {
169
144
let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
@@ -179,9 +154,7 @@ mod tests {
179
154
180
155
#[ tokio:: test]
181
156
async fn should_return_the_torrent_info_if_the_tracker_has_the_torrent ( ) {
182
- let config = tracker_configuration ( ) ;
183
-
184
- let in_memory_torrent_repository = initialize_in_memory_torrent_repository ( & config) ;
157
+ let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
185
158
186
159
let hash = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
187
160
let info_hash = InfoHash :: from_str ( & hash) . unwrap ( ) ;
@@ -210,17 +183,11 @@ mod tests {
210
183
use std:: sync:: Arc ;
211
184
212
185
use bittorrent_primitives:: info_hash:: InfoHash ;
213
- use torrust_tracker_configuration:: Configuration ;
214
- use torrust_tracker_test_helpers:: configuration;
215
186
216
- use crate :: core:: services:: torrent:: tests:: { initialize_in_memory_torrent_repository , sample_peer} ;
187
+ use crate :: core:: services:: torrent:: tests:: sample_peer;
217
188
use crate :: core:: services:: torrent:: { get_torrents_page, BasicInfo , Pagination } ;
218
189
use crate :: core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
219
190
220
- pub fn tracker_configuration ( ) -> Configuration {
221
- configuration:: ephemeral ( )
222
- }
223
-
224
191
#[ tokio:: test]
225
192
async fn should_return_an_empty_result_if_the_tracker_does_not_have_any_torrent ( ) {
226
193
let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
@@ -232,9 +199,7 @@ mod tests {
232
199
233
200
#[ tokio:: test]
234
201
async fn should_return_a_summarized_info_for_all_torrents ( ) {
235
- let config = tracker_configuration ( ) ;
236
-
237
- let in_memory_torrent_repository = initialize_in_memory_torrent_repository ( & config) ;
202
+ let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
238
203
239
204
let hash = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
240
205
let info_hash = InfoHash :: from_str ( & hash) . unwrap ( ) ;
@@ -256,9 +221,7 @@ mod tests {
256
221
257
222
#[ tokio:: test]
258
223
async fn should_allow_limiting_the_number_of_torrents_in_the_result ( ) {
259
- let config = tracker_configuration ( ) ;
260
-
261
- let in_memory_torrent_repository = initialize_in_memory_torrent_repository ( & config) ;
224
+ let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
262
225
263
226
let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
264
227
let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
@@ -279,9 +242,7 @@ mod tests {
279
242
280
243
#[ tokio:: test]
281
244
async fn should_allow_using_pagination_in_the_result ( ) {
282
- let config = tracker_configuration ( ) ;
283
-
284
- let in_memory_torrent_repository = initialize_in_memory_torrent_repository ( & config) ;
245
+ let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
285
246
286
247
let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
287
248
let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
@@ -311,9 +272,7 @@ mod tests {
311
272
312
273
#[ tokio:: test]
313
274
async fn should_return_torrents_ordered_by_info_hash ( ) {
314
- let config = tracker_configuration ( ) ;
315
-
316
- let in_memory_torrent_repository = initialize_in_memory_torrent_repository ( & config) ;
275
+ let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
317
276
318
277
let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
319
278
let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
0 commit comments