mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-26 00:51:44 +00:00
feat: Implement Garmin sync, login improvements, and utility scripts
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import pytest
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from src.services.auth_service import AuthService
|
||||
from src.schemas import UserCreate, User, TokenCreate, TokenUpdate
|
||||
import uuid
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from src.schemas import TokenCreate, User
|
||||
from src.services.auth_service import AuthService
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def auth_service():
|
||||
@@ -34,7 +37,9 @@ def mock_garth_client():
|
||||
yield mock_client
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_authenticate_garmin_connect_new_user_success(auth_service, mock_garth_login, mock_garth_client):
|
||||
async def test_authenticate_garmin_connect_new_user_success(
|
||||
auth_service, mock_garth_login, mock_garth_client
|
||||
):
|
||||
"""Test successful Garmin authentication with a new user."""
|
||||
email = "new_user@example.com"
|
||||
password = "password123"
|
||||
@@ -55,7 +60,9 @@ async def test_authenticate_garmin_connect_new_user_success(auth_service, mock_g
|
||||
assert result == {"message": "Garmin Connect authentication successful", "user_id": str(mock_user.id)}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_authenticate_garmin_connect_existing_user_success(auth_service, mock_garth_login, mock_garth_client):
|
||||
async def test_authenticate_garmin_connect_existing_user_success(
|
||||
auth_service, mock_garth_login, mock_garth_client
|
||||
):
|
||||
"""Test successful Garmin authentication with an existing user and no existing token."""
|
||||
email = "existing_user@example.com"
|
||||
password = "password123"
|
||||
@@ -75,7 +82,9 @@ async def test_authenticate_garmin_connect_existing_user_success(auth_service, m
|
||||
assert result == {"message": "Garmin Connect authentication successful", "user_id": str(mock_user.id)}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_authenticate_garmin_connect_existing_user_existing_token_success(auth_service, mock_garth_login, mock_garth_client):
|
||||
async def test_authenticate_garmin_connect_existing_user_existing_token_success(
|
||||
auth_service, mock_garth_login, mock_garth_client
|
||||
):
|
||||
"""Test successful Garmin authentication with an existing user and existing token."""
|
||||
email = "existing_user_token@example.com"
|
||||
password = "password123"
|
||||
@@ -117,7 +126,9 @@ async def test_authenticate_garmin_connect_garmin_failure(auth_service, mock_gar
|
||||
assert result is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_authenticate_garmin_connect_central_db_user_creation_failure(auth_service, mock_garth_login, mock_garth_client):
|
||||
async def test_authenticate_garmin_connect_central_db_user_creation_failure(
|
||||
auth_service, mock_garth_login, mock_garth_client
|
||||
):
|
||||
"""Test CentralDB user creation failure."""
|
||||
email = "fail_user_create@example.com"
|
||||
password = "password123"
|
||||
|
||||
Reference in New Issue
Block a user