feat: Add comprehensive Django user app with tests using model-bakery

- Implemented user authentication with JWT tokens
- Added user and profile models with OneToOne relationship
- Created service layer for business logic separation
- Implemented DRF serializers and views
- Added comprehensive test suite with model-bakery factories
- Fixed ipdb/pdbpp dependency conflicts with custom test runner
- Configured development and production environments
- Added deployment configurations for Apache, systemd, and Docker
This commit is contained in:
2026-01-19 14:12:33 +01:00
commit cbfbd8652d
51 changed files with 4183 additions and 0 deletions

54
check_tests.py Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python
"""Проверка тестовой среды"""
import os
import sys
import django
# Настройка Django
sys.path.append(os.path.join(os.getcwd(), 'src'))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.development')
django.setup()
print("✅ Django настроен успешно!")
# Проверка импортов
try:
from apps.user.tests.test_views import *
print("✅ test_views импортирован успешно!")
except Exception as e:
print(f"❌ Ошибка импорта test_views: {e}")
try:
from apps.user.tests.test_models import *
print("✅ test_models импортирован успешно!")
except Exception as e:
print(f"❌ Ошибка импорта test_models: {e}")
try:
from apps.user.tests.test_serializers import *
print("✅ test_serializers импортирован успешно!")
except Exception as e:
print(f"❌ Ошибка импорта test_serializers: {e}")
try:
from apps.user.tests.test_services import *
print("✅ test_services импортирован успешно!")
except Exception as e:
print(f"❌ Ошибка импорта test_services: {e}")
try:
from apps.user.tests.factories import UserFactory, ProfileFactory
print("✅ factories импортированы успешно!")
# Тест создания объектов
user = UserFactory.create_user()
print(f"✅ Создан пользователь: {user.username}")
profile = ProfileFactory.create_profile()
print(f"✅ Создан профиль: {profile.full_name}")
except Exception as e:
print(f"❌ Ошибка работы с фабриками: {e}")
print("\n🏁 Проверка завершена!")