feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.

This commit is contained in:
pacnpal
2025-12-28 17:32:53 -05:00
parent aa56c46c27
commit c95f99ca10
452 changed files with 7948 additions and 6073 deletions

View File

@@ -16,17 +16,11 @@ This module provides extensive test coverage for:
Test patterns follow Django styleguide conventions.
"""
import pytest
from unittest.mock import patch, MagicMock
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
from rest_framework.test import APIClient
from tests.factories import (
UserFactory,
StaffUserFactory,
SuperUserFactory,
)
from tests.test_utils import EnhancedAPITestCase

View File

@@ -6,8 +6,8 @@ with proper error codes, messages, and details.
"""
from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APIClient
class ErrorResponseFormatTestCase(TestCase):

View File

@@ -6,8 +6,8 @@ similar endpoints and behave as expected.
"""
from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APIClient
class FilterParameterNamingTestCase(TestCase):
@@ -137,7 +137,7 @@ class FilterMetadataTestCase(TestCase):
if response.status_code == status.HTTP_200_OK:
data = response.json()
if data.get("data") and data["data"].get("categorical"):
for field, options in data["data"]["categorical"].items():
for _field, options in data["data"]["categorical"].items():
if isinstance(options, list) and options:
option = options[0]
# Each option should have value and label

View File

@@ -6,8 +6,8 @@ metadata including count, next, previous, page_size, current_page, and total_pag
"""
from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APIClient
class PaginationMetadataTestCase(TestCase):

View File

@@ -13,20 +13,18 @@ Test patterns follow Django styleguide conventions with:
- Permission and authorization testing
"""
import pytest
from unittest.mock import patch, MagicMock
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
from unittest.mock import patch
from apps.parks.models import Park, ParkPhoto
from rest_framework import status
from rest_framework.test import APIClient
from apps.parks.models import Park
from tests.factories import (
UserFactory,
CompanyFactory,
ParkFactory,
StaffUserFactory,
SuperUserFactory,
ParkFactory,
CompanyFactory,
UserFactory,
)
from tests.test_utils import EnhancedAPITestCase
@@ -471,7 +469,7 @@ class TestParkAPIQueryOptimization(EnhancedAPITestCase):
def test__park_list__uses_select_related(self):
"""Test that park list uses select_related for optimization."""
# Create multiple parks
for i in range(5):
for _i in range(5):
ParkFactory(operator=self.operator)
url = '/api/v1/parks/hybrid/'

View File

@@ -5,10 +5,9 @@ These tests verify that all API endpoints return responses in the standardized
format with proper success/error indicators, data nesting, and error codes.
"""
import pytest
from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APIClient
class ResponseFormatTestCase(TestCase):

View File

@@ -15,24 +15,18 @@ This module provides extensive test coverage for:
Test patterns follow Django styleguide conventions.
"""
import pytest
from unittest.mock import patch, MagicMock
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
from rest_framework.test import APIClient
from tests.factories import (
UserFactory,
StaffUserFactory,
SuperUserFactory,
CoasterFactory,
DesignerCompanyFactory,
ManufacturerCompanyFactory,
ParkFactory,
RideFactory,
CoasterFactory,
CompanyFactory,
ManufacturerCompanyFactory,
DesignerCompanyFactory,
RideModelFactory,
StaffUserFactory,
UserFactory,
)
from tests.test_utils import EnhancedAPITestCase
@@ -752,7 +746,7 @@ class TestRideAPIQueryOptimization(EnhancedAPITestCase):
def test__ride_list__uses_select_related(self):
"""Test that ride list uses select_related for optimization."""
# Create multiple rides
for i in range(5):
for _i in range(5):
RideFactory(park=self.park)
response = self.client.get('/api/v1/rides/')