Files
apuc 756f40353b Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF):
- accounts: phone OTP login, JWT, profile, addresses
- catalog: categories, products, images, filters, search, hits/new/related
- orders: creation with Idempotency-Key, stock reservation, status history, cancel
- loyalty: bonus accounts, promo codes, gift certificates
- payments: payment records and YooKassa webhook handling
- content: static pages, banners, site settings
- integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses)
- common: error envelope, pagination, request-id, integration auth, admin dashboard

Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx),
requirements split by environment, OpenAPI contracts for site and 1C, architecture doc.

Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
2026-11-22 21:54:16 +03:00

45 lines
1.7 KiB
Python

from django.contrib.auth.models import Group
from django.core.management import call_command
from django.test import TestCase
from apps.accounts.models import User
class AdminSmokeTests(TestCase):
def setUp(self):
self.admin = User.objects.create_superuser(
phone="+79990000000", password="admin12345"
)
self.client.force_login(self.admin)
def test_admin_index_renders_dashboard(self):
response = self.client.get("/admin/")
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Сводка")
def test_admin_changelists(self):
urls = [
"/admin/orders/order/",
"/admin/catalog/product/",
"/admin/accounts/user/",
"/admin/loyalty/promocode/",
"/admin/integration/syncrun/",
"/admin/integration/outboxmessage/",
"/admin/content/sitesettings/",
"/admin/content/staticpage/",
"/admin/content/banner/",
"/admin/admin/logentry/",
]
for url in urls:
with self.subTest(url=url):
self.assertEqual(self.client.get(url).status_code, 200)
class RolesCommandTests(TestCase):
def test_create_roles(self):
call_command("create_roles")
self.assertTrue(Group.objects.filter(name="Контент-менеджер").exists())
self.assertTrue(Group.objects.filter(name="Менеджер заказов").exists())
self.assertTrue(Group.objects.filter(name="Менеджер лояльности").exists())
self.assertTrue(Group.objects.filter(name="Технический администратор").exists())