File tree Expand file tree Collapse file tree
tests/servers/api/v1/contract/context Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -988,9 +988,7 @@ impl Tracker {
988988 /// # Errors
989989 ///
990990 /// Will return a `key::Error` if unable to get any `auth_key`.
991- pub async fn verify_auth_key ( & self , key : & Key ) -> Result < ( ) , auth:: Error > {
992- // code-review: this function is public only because it's used in a test.
993- // We should change the test and make it private.
991+ async fn verify_auth_key ( & self , key : & Key ) -> Result < ( ) , auth:: Error > {
994992 match self . keys . read ( ) . await . get ( key) {
995993 None => Err ( auth:: Error :: UnableToReadKey {
996994 location : Location :: caller ( ) ,
@@ -1830,13 +1828,11 @@ mod tests {
18301828
18311829 #[ tokio:: test]
18321830 async fn it_should_verify_a_valid_authentication_key ( ) {
1833- // todo: this should not be tested directly because
1834- // `verify_auth_key` should be a private method.
18351831 let tracker = private_tracker ( ) ;
18361832
18371833 let expiring_key = tracker. generate_auth_key ( Some ( Duration :: from_secs ( 100 ) ) ) . await . unwrap ( ) ;
18381834
1839- assert ! ( tracker. verify_auth_key ( & expiring_key. key( ) ) . await . is_ok( ) ) ;
1835+ assert ! ( tracker. authenticate ( & expiring_key. key( ) ) . await . is_ok( ) ) ;
18401836 }
18411837
18421838 #[ tokio:: test]
Original file line number Diff line number Diff line change @@ -26,10 +26,9 @@ async fn should_allow_generating_a_new_random_auth_key() {
2626
2727 let auth_key_resource = assert_auth_key_utf8 ( response) . await ;
2828
29- // Verify the key with the tracker
3029 assert ! ( env
3130 . tracker
32- . verify_auth_key ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
31+ . authenticate ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
3332 . await
3433 . is_ok( ) ) ;
3534
@@ -49,10 +48,9 @@ async fn should_allow_uploading_a_preexisting_auth_key() {
4948
5049 let auth_key_resource = assert_auth_key_utf8 ( response) . await ;
5150
52- // Verify the key with the tracker
5351 assert ! ( env
5452 . tracker
55- . verify_auth_key ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
53+ . authenticate ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
5654 . await
5755 . is_ok( ) ) ;
5856
@@ -357,10 +355,9 @@ mod deprecated_generate_key_endpoint {
357355
358356 let auth_key_resource = assert_auth_key_utf8 ( response) . await ;
359357
360- // Verify the key with the tracker
361358 assert ! ( env
362359 . tracker
363- . verify_auth_key ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
360+ . authenticate ( & auth_key_resource. key. parse:: <Key >( ) . unwrap( ) )
364361 . await
365362 . is_ok( ) ) ;
366363
You can’t perform that action at this time.
0 commit comments