Refactor test utilities and enhance ASGI settings

- Cleaned up and standardized assertions in ApiTestMixin for API response validation.
- Updated ASGI settings to use os.environ for setting the DJANGO_SETTINGS_MODULE.
- Removed unused imports and improved formatting in settings.py.
- Refactored URL patterns in urls.py for better readability and organization.
- Enhanced view functions in views.py for consistency and clarity.
- Added .flake8 configuration for linting and style enforcement.
- Introduced type stubs for django-environ to improve type checking with Pylance.
This commit is contained in:
pacnpal
2025-08-20 19:51:59 -04:00
parent 69c07d1381
commit 66ed4347a9
230 changed files with 15094 additions and 11578 deletions

View File

@@ -9,29 +9,27 @@ from ..views.map_views import (
MapSearchView,
MapBoundsView,
MapStatsView,
MapCacheView
MapCacheView,
)
app_name = 'map_api'
app_name = "map_api"
urlpatterns = [
# Main map data endpoint
path('locations/', MapLocationsView.as_view(), name='locations'),
path("locations/", MapLocationsView.as_view(), name="locations"),
# Location detail endpoint
path('locations/<str:location_type>/<int:location_id>/',
MapLocationDetailView.as_view(), name='location_detail'),
path(
"locations/<str:location_type>/<int:location_id>/",
MapLocationDetailView.as_view(),
name="location_detail",
),
# Search endpoint
path('search/', MapSearchView.as_view(), name='search'),
path("search/", MapSearchView.as_view(), name="search"),
# Bounds-based query endpoint
path('bounds/', MapBoundsView.as_view(), name='bounds'),
path("bounds/", MapBoundsView.as_view(), name="bounds"),
# Service statistics endpoint
path('stats/', MapStatsView.as_view(), name='stats'),
path("stats/", MapStatsView.as_view(), name="stats"),
# Cache management endpoints
path('cache/', MapCacheView.as_view(), name='cache'),
path('cache/invalidate/', MapCacheView.as_view(), name='cache_invalidate'),
]
path("cache/", MapCacheView.as_view(), name="cache"),
path("cache/invalidate/", MapCacheView.as_view(), name="cache_invalidate"),
]

View File

@@ -15,19 +15,25 @@ from ..views.maps import (
LocationListView,
)
app_name = 'maps'
app_name = "maps"
urlpatterns = [
# Main map views
path('', UniversalMapView.as_view(), name='universal_map'),
path('parks/', ParkMapView.as_view(), name='park_map'),
path('nearby/', NearbyLocationsView.as_view(), name='nearby_locations'),
path('list/', LocationListView.as_view(), name='location_list'),
path("", UniversalMapView.as_view(), name="universal_map"),
path("parks/", ParkMapView.as_view(), name="park_map"),
path("nearby/", NearbyLocationsView.as_view(), name="nearby_locations"),
path("list/", LocationListView.as_view(), name="location_list"),
# HTMX endpoints for dynamic updates
path('htmx/filter/', LocationFilterView.as_view(), name='htmx_filter'),
path('htmx/search/', LocationSearchView.as_view(), name='htmx_search'),
path('htmx/bounds/', MapBoundsUpdateView.as_view(), name='htmx_bounds_update'),
path('htmx/location/<str:location_type>/<int:location_id>/',
LocationDetailModalView.as_view(), name='htmx_location_detail'),
]
path("htmx/filter/", LocationFilterView.as_view(), name="htmx_filter"),
path("htmx/search/", LocationSearchView.as_view(), name="htmx_search"),
path(
"htmx/bounds/",
MapBoundsUpdateView.as_view(),
name="htmx_bounds_update",
),
path(
"htmx/location/<str:location_type>/<int:location_id>/",
LocationDetailModalView.as_view(),
name="htmx_location_detail",
),
]

View File

@@ -3,19 +3,22 @@ from core.views.search import (
AdaptiveSearchView,
FilterFormView,
LocationSearchView,
LocationSuggestionsView
LocationSuggestionsView,
)
from rides.views import RideSearchView
app_name = 'search'
app_name = "search"
urlpatterns = [
path('parks/', AdaptiveSearchView.as_view(), name='search'),
path('parks/filters/', FilterFormView.as_view(), name='filter_form'),
path('rides/', RideSearchView.as_view(), name='ride_search'),
path('rides/results/', RideSearchView.as_view(), name='ride_search_results'),
path("parks/", AdaptiveSearchView.as_view(), name="search"),
path("parks/filters/", FilterFormView.as_view(), name="filter_form"),
path("rides/", RideSearchView.as_view(), name="ride_search"),
path("rides/results/", RideSearchView.as_view(), name="ride_search_results"),
# Location-aware search
path('location/', LocationSearchView.as_view(), name='location_search'),
path('location/suggestions/', LocationSuggestionsView.as_view(), name='location_suggestions'),
]
path("location/", LocationSearchView.as_view(), name="location_search"),
path(
"location/suggestions/",
LocationSuggestionsView.as_view(),
name="location_suggestions",
),
]