style: apply ruff auto-fix
- Auto-formatted code with ruff format - Applied ruff linting fixes with --fix Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -6,11 +6,10 @@ Focuses on:
|
|||||||
- Token retrieval error paths
|
- Token retrieval error paths
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import MagicMock, Mock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi import HTTPException
|
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +208,7 @@ class TestSaveGoogleDriveSettings:
|
|||||||
"client_id": "new_id",
|
"client_id": "new_id",
|
||||||
"client_secret": "new_secret",
|
"client_secret": "new_secret",
|
||||||
"folder_id": "folder123",
|
"folder_id": "folder123",
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
@@ -223,10 +222,7 @@ class TestSaveGoogleDriveSettings:
|
|||||||
"""Test saving with only refresh_token (minimal required field)."""
|
"""Test saving with only refresh_token (minimal required field)."""
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
|
|
||||||
response = client.post(
|
response = client.post("/api/google-drive/save-settings", data={"refresh_token": "new_token"})
|
||||||
"/api/google-drive/save-settings",
|
|
||||||
data={"refresh_token": "new_token"}
|
|
||||||
)
|
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
data = response.json()
|
data = response.json()
|
||||||
@@ -239,10 +235,7 @@ class TestSaveGoogleDriveSettings:
|
|||||||
"""Test saving when .env file write fails but continues with in-memory update."""
|
"""Test saving when .env file write fails but continues with in-memory update."""
|
||||||
mock_exists.return_value = True
|
mock_exists.return_value = True
|
||||||
|
|
||||||
response = client.post(
|
response = client.post("/api/google-drive/save-settings", data={"refresh_token": "new_token"})
|
||||||
"/api/google-drive/save-settings",
|
|
||||||
data={"refresh_token": "new_token"}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Should succeed (in-memory update) even if file write fails
|
# Should succeed (in-memory update) even if file write fails
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
@@ -257,7 +250,6 @@ class TestHelperFunctions:
|
|||||||
def test_format_time_remaining_expired(self):
|
def test_format_time_remaining_expired(self):
|
||||||
"""Test format_time_remaining with negative timedelta."""
|
"""Test format_time_remaining with negative timedelta."""
|
||||||
from app.api.google_drive import format_time_remaining
|
from app.api.google_drive import format_time_remaining
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
# Expired time
|
# Expired time
|
||||||
delta = timedelta(seconds=-1)
|
delta = timedelta(seconds=-1)
|
||||||
@@ -267,7 +259,6 @@ class TestHelperFunctions:
|
|||||||
def test_format_time_remaining_days(self):
|
def test_format_time_remaining_days(self):
|
||||||
"""Test format_time_remaining with days."""
|
"""Test format_time_remaining with days."""
|
||||||
from app.api.google_drive import format_time_remaining
|
from app.api.google_drive import format_time_remaining
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
# 2 days, 3 hours
|
# 2 days, 3 hours
|
||||||
delta = timedelta(days=2, hours=3)
|
delta = timedelta(days=2, hours=3)
|
||||||
@@ -278,7 +269,6 @@ class TestHelperFunctions:
|
|||||||
def test_format_time_remaining_hours_only(self):
|
def test_format_time_remaining_hours_only(self):
|
||||||
"""Test format_time_remaining with hours but no days."""
|
"""Test format_time_remaining with hours but no days."""
|
||||||
from app.api.google_drive import format_time_remaining
|
from app.api.google_drive import format_time_remaining
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
# 5 hours, 30 minutes
|
# 5 hours, 30 minutes
|
||||||
delta = timedelta(hours=5, minutes=30)
|
delta = timedelta(hours=5, minutes=30)
|
||||||
@@ -289,7 +279,6 @@ class TestHelperFunctions:
|
|||||||
def test_format_time_remaining_singular_units(self):
|
def test_format_time_remaining_singular_units(self):
|
||||||
"""Test format_time_remaining with singular units."""
|
"""Test format_time_remaining with singular units."""
|
||||||
from app.api.google_drive import format_time_remaining
|
from app.api.google_drive import format_time_remaining
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
# 1 day, 1 hour
|
# 1 day, 1 hour
|
||||||
delta = timedelta(days=1, hours=1)
|
delta = timedelta(days=1, hours=1)
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ Focuses on:
|
|||||||
- Mixed encryption states
|
- Mixed encryption states
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from unittest.mock import Mock, patch, MagicMock
|
|
||||||
|
|
||||||
from app.models import ApplicationSettings
|
from app.models import ApplicationSettings
|
||||||
from app.utils.settings_service import (
|
from app.utils.settings_service import (
|
||||||
|
|||||||
Reference in New Issue
Block a user