@@ -112,29 +112,10 @@ pub async fn get_torrents(
112112#[ cfg( test) ]
113113mod tests {
114114 use std:: net:: { IpAddr , Ipv4Addr , SocketAddr } ;
115- use std:: sync:: Arc ;
116115
117116 use aquatic_udp_protocol:: { AnnounceEvent , NumberOfBytes , PeerId } ;
118- use torrust_tracker_configuration:: Configuration ;
119117 use torrust_tracker_primitives:: { peer, DurationSinceUnixEpoch } ;
120118
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-
138119 fn sample_peer ( ) -> peer:: Peer {
139120 peer:: Peer {
140121 peer_id : PeerId ( * b"-qB00000000000000000" ) ,
@@ -153,17 +134,11 @@ mod tests {
153134 use std:: sync:: Arc ;
154135
155136 use bittorrent_primitives:: info_hash:: InfoHash ;
156- use torrust_tracker_configuration:: Configuration ;
157- use torrust_tracker_test_helpers:: configuration;
158137
159- use crate :: core:: services:: torrent:: tests:: { initialize_in_memory_torrent_repository , sample_peer} ;
138+ use crate :: core:: services:: torrent:: tests:: sample_peer;
160139 use crate :: core:: services:: torrent:: { get_torrent_info, Info } ;
161140 use crate :: core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
162141
163- pub fn tracker_configuration ( ) -> Configuration {
164- configuration:: ephemeral ( )
165- }
166-
167142 #[ tokio:: test]
168143 async fn should_return_none_if_the_tracker_does_not_have_the_torrent ( ) {
169144 let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
@@ -179,9 +154,7 @@ mod tests {
179154
180155 #[ tokio:: test]
181156 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 ( ) ) ;
185158
186159 let hash = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
187160 let info_hash = InfoHash :: from_str ( & hash) . unwrap ( ) ;
@@ -210,17 +183,11 @@ mod tests {
210183 use std:: sync:: Arc ;
211184
212185 use bittorrent_primitives:: info_hash:: InfoHash ;
213- use torrust_tracker_configuration:: Configuration ;
214- use torrust_tracker_test_helpers:: configuration;
215186
216- use crate :: core:: services:: torrent:: tests:: { initialize_in_memory_torrent_repository , sample_peer} ;
187+ use crate :: core:: services:: torrent:: tests:: sample_peer;
217188 use crate :: core:: services:: torrent:: { get_torrents_page, BasicInfo , Pagination } ;
218189 use crate :: core:: torrent:: repository:: in_memory:: InMemoryTorrentRepository ;
219190
220- pub fn tracker_configuration ( ) -> Configuration {
221- configuration:: ephemeral ( )
222- }
223-
224191 #[ tokio:: test]
225192 async fn should_return_an_empty_result_if_the_tracker_does_not_have_any_torrent ( ) {
226193 let in_memory_torrent_repository = Arc :: new ( InMemoryTorrentRepository :: default ( ) ) ;
@@ -232,9 +199,7 @@ mod tests {
232199
233200 #[ tokio:: test]
234201 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 ( ) ) ;
238203
239204 let hash = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
240205 let info_hash = InfoHash :: from_str ( & hash) . unwrap ( ) ;
@@ -256,9 +221,7 @@ mod tests {
256221
257222 #[ tokio:: test]
258223 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 ( ) ) ;
262225
263226 let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
264227 let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
@@ -279,9 +242,7 @@ mod tests {
279242
280243 #[ tokio:: test]
281244 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 ( ) ) ;
285246
286247 let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
287248 let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
@@ -311,9 +272,7 @@ mod tests {
311272
312273 #[ tokio:: test]
313274 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 ( ) ) ;
317276
318277 let hash1 = "9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d" . to_owned ( ) ;
319278 let info_hash1 = InfoHash :: from_str ( & hash1) . unwrap ( ) ;
0 commit comments