fix(auth): use consistent warning log level and verify logging in tests

parent bc5d548b
......@@ -491,7 +491,7 @@ class KiloOAuth2:
if self.credentials and self.credentials.get('expires', 0) > time.time():
return self.credentials.get('access')
logger.error("KiloOAuth2: Token expired")
logger.warning("KiloOAuth2: Token expired")
return None
def is_authenticated(self) -> bool:
......
......@@ -54,7 +54,7 @@ async def test_get_valid_token_with_refresh_returns_valid_token(temp_credentials
@pytest.mark.asyncio
async def test_get_valid_token_with_refresh_returns_none_when_expired(temp_credentials_file, expired_credentials):
async def test_get_valid_token_with_refresh_returns_none_when_expired(temp_credentials_file, expired_credentials, caplog):
"""Test that get_valid_token_with_refresh returns None when token expired."""
with open(temp_credentials_file, 'w') as f:
json.dump(expired_credentials, f)
......@@ -64,3 +64,4 @@ async def test_get_valid_token_with_refresh_returns_none_when_expired(temp_crede
token = await oauth2.get_valid_token_with_refresh()
assert token is None
assert "Token expired" in caplog.text
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment