@@ -153,27 +153,29 @@ mod tests {
153
153
use crate :: core:: authentication;
154
154
use crate :: core:: services:: initialize_database;
155
155
156
- fn instantiate_authentication ( ) -> authentication:: Facade {
156
+ fn instantiate_authentication_facade ( ) -> authentication:: Facade {
157
157
let config = configuration:: ephemeral_private ( ) ;
158
158
159
159
let database = initialize_database ( & config) ;
160
+
160
161
authentication:: Facade :: new ( & config. core , & database. clone ( ) )
161
162
}
162
163
163
- fn instantiate_authentication_with_checking_keys_expiration_disabled ( ) -> authentication:: Facade {
164
+ fn instantiate_authentication_facade_with_checking_keys_expiration_disabled ( ) -> authentication:: Facade {
164
165
let mut config = configuration:: ephemeral_private ( ) ;
165
166
166
167
config. core . private_mode = Some ( PrivateMode {
167
168
check_keys_expiration : false ,
168
169
} ) ;
169
170
170
171
let database = initialize_database ( & config) ;
172
+
171
173
authentication:: Facade :: new ( & config. core , & database. clone ( ) )
172
174
}
173
175
174
176
#[ tokio:: test]
175
177
async fn it_should_remove_an_authentication_key ( ) {
176
- let authentication = instantiate_authentication ( ) ;
178
+ let authentication = instantiate_authentication_facade ( ) ;
177
179
178
180
let expiring_key = authentication
179
181
. generate_auth_key ( Some ( Duration :: from_secs ( 100 ) ) )
@@ -194,7 +196,7 @@ mod tests {
194
196
195
197
#[ tokio:: test]
196
198
async fn it_should_load_authentication_keys_from_the_database ( ) {
197
- let authentication = instantiate_authentication ( ) ;
199
+ let authentication = instantiate_authentication_facade ( ) ;
198
200
199
201
let expiring_key = authentication
200
202
. generate_auth_key ( Some ( Duration :: from_secs ( 100 ) ) )
@@ -222,13 +224,13 @@ mod tests {
222
224
use std:: time:: Duration ;
223
225
224
226
use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: {
225
- instantiate_authentication , instantiate_authentication_with_checking_keys_expiration_disabled ,
227
+ instantiate_authentication_facade , instantiate_authentication_facade_with_checking_keys_expiration_disabled ,
226
228
} ;
227
229
use crate :: core:: authentication:: Key ;
228
230
229
231
#[ tokio:: test]
230
232
async fn it_should_authenticate_a_peer_with_the_key ( ) {
231
- let authentication = instantiate_authentication ( ) ;
233
+ let authentication = instantiate_authentication_facade ( ) ;
232
234
233
235
let peer_key = authentication
234
236
. generate_auth_key ( Some ( Duration :: from_secs ( 100 ) ) )
@@ -242,7 +244,7 @@ mod tests {
242
244
243
245
#[ tokio:: test]
244
246
async fn it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ( ) {
245
- let authentication = instantiate_authentication_with_checking_keys_expiration_disabled ( ) ;
247
+ let authentication = instantiate_authentication_facade_with_checking_keys_expiration_disabled ( ) ;
246
248
247
249
let past_timestamp = Duration :: ZERO ;
248
250
@@ -258,13 +260,13 @@ mod tests {
258
260
mod pre_generated_keys {
259
261
260
262
use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: {
261
- instantiate_authentication , instantiate_authentication_with_checking_keys_expiration_disabled ,
263
+ instantiate_authentication_facade , instantiate_authentication_facade_with_checking_keys_expiration_disabled ,
262
264
} ;
263
265
use crate :: core:: authentication:: { AddKeyRequest , Key } ;
264
266
265
267
#[ tokio:: test]
266
268
async fn it_should_authenticate_a_peer_with_the_key ( ) {
267
- let authentication = instantiate_authentication ( ) ;
269
+ let authentication = instantiate_authentication_facade ( ) ;
268
270
269
271
let peer_key = authentication
270
272
. add_peer_key ( AddKeyRequest {
@@ -281,7 +283,7 @@ mod tests {
281
283
282
284
#[ tokio:: test]
283
285
async fn it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ( ) {
284
- let authentication = instantiate_authentication_with_checking_keys_expiration_disabled ( ) ;
286
+ let authentication = instantiate_authentication_facade_with_checking_keys_expiration_disabled ( ) ;
285
287
286
288
let peer_key = authentication
287
289
. add_peer_key ( AddKeyRequest {
@@ -299,11 +301,11 @@ mod tests {
299
301
mod with_permanent_and {
300
302
301
303
mod randomly_generated_keys {
302
- use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: instantiate_authentication ;
304
+ use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: instantiate_authentication_facade ;
303
305
304
306
#[ tokio:: test]
305
307
async fn it_should_authenticate_a_peer_with_the_key ( ) {
306
- let authentication = instantiate_authentication ( ) ;
308
+ let authentication = instantiate_authentication_facade ( ) ;
307
309
308
310
let peer_key = authentication. generate_permanent_auth_key ( ) . await . unwrap ( ) ;
309
311
@@ -314,12 +316,12 @@ mod tests {
314
316
}
315
317
316
318
mod pre_generated_keys {
317
- use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: instantiate_authentication ;
319
+ use crate :: core:: authentication:: tests:: the_tracker_configured_as_private:: instantiate_authentication_facade ;
318
320
use crate :: core:: authentication:: { AddKeyRequest , Key } ;
319
321
320
322
#[ tokio:: test]
321
323
async fn it_should_authenticate_a_peer_with_the_key ( ) {
322
- let authentication = instantiate_authentication ( ) ;
324
+ let authentication = instantiate_authentication_facade ( ) ;
323
325
324
326
let peer_key = authentication
325
327
. add_peer_key ( AddKeyRequest {
0 commit comments