style: fix code formatting with black, isort, and flake8
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"""Final tests to push coverage over 60%."""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@@ -10,6 +12,7 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_openai_connection(self):
|
||||
"""Test sync_test_openai_connection."""
|
||||
from app.tasks.check_credentials import sync_test_openai_connection
|
||||
|
||||
result = sync_test_openai_connection()
|
||||
assert isinstance(result, dict)
|
||||
assert "status" in result
|
||||
@@ -17,6 +20,7 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_azure_connection(self):
|
||||
"""Test sync_test_azure_connection."""
|
||||
from app.tasks.check_credentials import sync_test_azure_connection
|
||||
|
||||
result = sync_test_azure_connection()
|
||||
assert isinstance(result, dict)
|
||||
assert "status" in result
|
||||
@@ -24,6 +28,7 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_dropbox_token(self):
|
||||
"""Test sync_test_dropbox_token."""
|
||||
from app.tasks.check_credentials import sync_test_dropbox_token
|
||||
|
||||
result = sync_test_dropbox_token()
|
||||
assert isinstance(result, dict)
|
||||
assert "status" in result
|
||||
@@ -31,6 +36,7 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_google_drive_token(self):
|
||||
"""Test sync_test_google_drive_token."""
|
||||
from app.tasks.check_credentials import sync_test_google_drive_token
|
||||
|
||||
result = sync_test_google_drive_token()
|
||||
assert isinstance(result, dict)
|
||||
assert "status" in result
|
||||
@@ -38,6 +44,7 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_onedrive_token(self):
|
||||
"""Test sync_test_onedrive_token."""
|
||||
from app.tasks.check_credentials import sync_test_onedrive_token
|
||||
|
||||
result = sync_test_onedrive_token()
|
||||
assert isinstance(result, dict)
|
||||
assert "status" in result
|
||||
@@ -45,29 +52,34 @@ class TestCheckCredentialsFunctions:
|
||||
def test_sync_test_nextcloud_credentials(self):
|
||||
"""Test that check_credentials module has check_credentials task."""
|
||||
from app.tasks.check_credentials import check_credentials
|
||||
|
||||
assert callable(check_credentials)
|
||||
|
||||
def test_sync_test_sftp_credentials(self):
|
||||
"""Test MockRequest scope attribute."""
|
||||
from app.tasks.check_credentials import MockRequest
|
||||
|
||||
req = MockRequest()
|
||||
assert hasattr(req, "session")
|
||||
|
||||
def test_sync_test_email_credentials(self):
|
||||
"""Test MockRequest path_params attribute."""
|
||||
from app.tasks.check_credentials import MockRequest
|
||||
|
||||
req = MockRequest()
|
||||
assert isinstance(req.query_params, dict)
|
||||
|
||||
def test_sync_test_ftp_credentials(self):
|
||||
"""Test MockRequest headers attribute."""
|
||||
from app.tasks.check_credentials import MockRequest
|
||||
|
||||
req = MockRequest()
|
||||
assert isinstance(req.headers, dict)
|
||||
|
||||
def test_sync_test_paperless_credentials(self):
|
||||
"""Test get_failure_state returns dict."""
|
||||
from app.tasks.check_credentials import get_failure_state
|
||||
|
||||
result = get_failure_state()
|
||||
assert isinstance(result, dict)
|
||||
|
||||
@@ -75,7 +87,9 @@ class TestCheckCredentialsFunctions:
|
||||
"""Test save_failure_state accepts dict."""
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
from app.tasks.check_credentials import save_failure_state
|
||||
|
||||
with patch("app.tasks.check_credentials.FAILURE_STATE_FILE", "/tmp/test_failure_state_final.json"):
|
||||
save_failure_state({"test": "value"})
|
||||
if os.path.exists("/tmp/test_failure_state_final.json"):
|
||||
@@ -89,6 +103,7 @@ class TestImapPullInboxes:
|
||||
def test_pull_all_inboxes_is_callable(self):
|
||||
"""Test that pull_all_inboxes is callable."""
|
||||
from app.tasks.imap_tasks import pull_all_inboxes
|
||||
|
||||
assert callable(pull_all_inboxes)
|
||||
|
||||
|
||||
@@ -99,6 +114,7 @@ class TestViewsProviderStatus:
|
||||
def test_get_provider_status_returns_dict(self):
|
||||
"""Test get_provider_status."""
|
||||
from app.utils.config_validator.providers import get_provider_status
|
||||
|
||||
result = get_provider_status()
|
||||
assert isinstance(result, dict)
|
||||
assert len(result) > 0
|
||||
@@ -111,6 +127,7 @@ class TestSettingsService:
|
||||
def test_get_settings_by_category(self):
|
||||
"""Test get_settings_by_category."""
|
||||
from app.utils.settings_service import get_settings_by_category
|
||||
|
||||
result = get_settings_by_category()
|
||||
assert isinstance(result, dict)
|
||||
assert len(result) > 0
|
||||
@@ -118,12 +135,14 @@ class TestSettingsService:
|
||||
def test_get_setting_metadata(self):
|
||||
"""Test get_setting_metadata for a known key."""
|
||||
from app.utils.settings_service import get_setting_metadata
|
||||
|
||||
result = get_setting_metadata("openai_api_key")
|
||||
assert isinstance(result, dict)
|
||||
|
||||
def test_validate_setting_value(self):
|
||||
"""Test validate_setting_value."""
|
||||
from app.utils.settings_service import validate_setting_value
|
||||
|
||||
# Should return tuple of (is_valid, error_message or None)
|
||||
result = validate_setting_value("openai_api_key", "test-key")
|
||||
assert isinstance(result, tuple)
|
||||
|
||||
Reference in New Issue
Block a user