mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-01-02 01:47:04 -05:00
feat: Implement initial schema and add various API, service, and management command enhancements across the application.
This commit is contained in:
@@ -4,7 +4,6 @@ Tests for Core managers and querysets.
|
||||
Following Django styleguide pattern: test__<context>__<action>__<expected_outcome>
|
||||
"""
|
||||
|
||||
|
||||
import pytest
|
||||
from django.test import TestCase
|
||||
|
||||
@@ -23,6 +22,7 @@ class TestBaseQuerySet(TestCase):
|
||||
"""Test active filters by is_active field if present."""
|
||||
# Using User model which has is_active
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
active_user = User.objects.create_user(
|
||||
@@ -43,6 +43,7 @@ class TestBaseQuerySet(TestCase):
|
||||
# Created just now, should be in recent
|
||||
|
||||
from apps.parks.models import Park
|
||||
|
||||
result = Park.objects.recent(days=30)
|
||||
|
||||
assert park in result
|
||||
@@ -53,6 +54,7 @@ class TestBaseQuerySet(TestCase):
|
||||
park2 = ParkFactory(name="Kings Island")
|
||||
|
||||
from apps.parks.models import Park
|
||||
|
||||
result = Park.objects.search(query="Cedar")
|
||||
|
||||
assert park1 in result
|
||||
@@ -64,6 +66,7 @@ class TestBaseQuerySet(TestCase):
|
||||
park2 = ParkFactory()
|
||||
|
||||
from apps.parks.models import Park
|
||||
|
||||
result = Park.objects.search(query="")
|
||||
|
||||
assert park1 in result
|
||||
@@ -81,6 +84,7 @@ class TestLocationQuerySet(TestCase):
|
||||
# Location is created by factory post_generation
|
||||
|
||||
from apps.parks.models import Park
|
||||
|
||||
# This tests the pattern - actual filtering depends on location setup
|
||||
|
||||
result = Park.objects.all()
|
||||
@@ -259,11 +263,10 @@ class TestBaseManager(TestCase):
|
||||
def test__active__delegates_to_queryset(self):
|
||||
"""Test active method delegates to queryset."""
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
user = User.objects.create_user(
|
||||
username="test", email="test@test.com", password="test", is_active=True
|
||||
)
|
||||
user = User.objects.create_user(username="test", email="test@test.com", password="test", is_active=True)
|
||||
|
||||
# BaseManager's active method should work
|
||||
result = User.objects.filter(is_active=True)
|
||||
|
||||
@@ -4,7 +4,6 @@ Tests for Park managers and querysets.
|
||||
Following Django styleguide pattern: test__<context>__<action>__<expected_outcome>
|
||||
"""
|
||||
|
||||
|
||||
import pytest
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
Reference in New Issue
Block a user