mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
chore: ran linting
This commit is contained in:
parent
de8841fb86
commit
e37e6d2d18
19 changed files with 36 additions and 35 deletions
|
|
@ -5,11 +5,10 @@ returned ``google.oauth2.credentials.Credentials`` object is correctly
|
|||
configured with a token and a working refresh handler.
|
||||
"""
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from google.oauth2.credentials import Credentials
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
|
@ -29,7 +28,7 @@ def test_returns_credentials_with_token_and_expiry(MockComposioService):
|
|||
assert isinstance(creds, Credentials)
|
||||
assert creds.token == "fake-access-token"
|
||||
assert creds.expiry is not None
|
||||
assert creds.expiry > datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
assert creds.expiry > datetime.now(UTC).replace(tzinfo=None)
|
||||
|
||||
|
||||
@patch("app.services.composio_service.ComposioService")
|
||||
|
|
@ -53,5 +52,5 @@ def test_refresh_handler_fetches_fresh_token(MockComposioService):
|
|||
new_token, new_expiry = refresh_handler(request=None, scopes=None)
|
||||
|
||||
assert new_token == "refreshed-token"
|
||||
assert new_expiry > datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
assert new_expiry > datetime.now(UTC).replace(tzinfo=None)
|
||||
assert mock_service.get_access_token.call_count == 2
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ allows Composio credentials through without raising ValueError or persisting to
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -21,7 +21,7 @@ pytestmark = pytest.mark.unit
|
|||
|
||||
def _utcnow_naive() -> datetime:
|
||||
"""Return current UTC time as a naive datetime (matches google-auth convention)."""
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
return datetime.now(UTC).replace(tzinfo=None)
|
||||
|
||||
|
||||
def _composio_credentials(*, expired: bool = False) -> Credentials:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue