File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
crates/api-keys-simplified Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ mod tests {
326326 assert ! ( KeyPrefix :: new( "sk" ) . is_ok( ) ) ;
327327 assert ! ( KeyPrefix :: new( "api_key" ) . is_ok( ) ) ;
328328 assert ! ( KeyPrefix :: new( "" ) . is_err( ) ) ;
329- assert ! ( KeyPrefix :: new( "invalid-prefix" ) . is_err ( ) ) ;
329+ assert ! ( KeyPrefix :: new( "invalid-prefix" ) . is_ok ( ) ) ;
330330 }
331331
332332 #[ test]
Original file line number Diff line number Diff line change @@ -87,8 +87,9 @@ fn test_expired_key_wrong_hash() {
8787/// Test very short expiry (seconds)
8888#[ test]
8989fn test_short_expiry ( ) {
90+ const EXPIRY : i64 = 3 ;
9091 let manager = ApiKeyManagerV0 :: init_default_config ( "sk" ) . unwrap ( ) ;
91- let expiry = Utc :: now ( ) + Duration :: seconds ( 3 ) ;
92+ let expiry = Utc :: now ( ) + Duration :: seconds ( EXPIRY ) ;
9293 let key = manager
9394 . generate_with_expiry ( Environment :: production ( ) , expiry)
9495 . unwrap ( ) ;
@@ -100,7 +101,7 @@ fn test_short_expiry() {
100101 ) ;
101102
102103 // Wait for expiry
103- std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 3 ) ) ;
104+ std:: thread:: sleep ( std:: time:: Duration :: from_secs ( EXPIRY as u64 + 1 ) ) ;
104105
105106 // Should now be expired
106107 assert_eq ! (
You can’t perform that action at this time.
0 commit comments