Wires the CRM (exoCRM GetOrders) into the dashboard as a locally persisted order queue instead of the previous static mockup: - CrmClient Protocol + ExoCrmClient/StubCrmClient for the CRM's signed JSON-RPC API - Order model + migration, synced from CRM on each queue view; soft-deleted orders stay hidden across re-syncs - GET/DELETE /api/v1/orders with "no receipt"/"receipt issued" tabs (the latter is empty until Checkbox fiscalization lands) - Dashboard: real order list, item-detail modal, tab switcher, one-click delete Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
840 B
Python
27 lines
840 B
Python
"""Юнит-тесты чистых хелперов сервиса заказов. Без БД и без сети."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from app.services.orders import _parse_crm_datetime, _to_kopecks
|
|
|
|
|
|
class TestToKopecks:
|
|
def test_converts_decimal_string_to_kopecks(self) -> None:
|
|
assert _to_kopecks("599.00") == 59900
|
|
|
|
def test_handles_fractional_kopecks(self) -> None:
|
|
assert _to_kopecks("12.34") == 1234
|
|
|
|
def test_handles_integer_without_fraction(self) -> None:
|
|
assert _to_kopecks("100") == 10000
|
|
|
|
def test_handles_zero(self) -> None:
|
|
assert _to_kopecks("0.00") == 0
|
|
|
|
|
|
class TestParseCrmDatetime:
|
|
def test_parses_crm_format(self) -> None:
|
|
assert _parse_crm_datetime("2026-09-20 10:00:00") == datetime(2026, 9, 20, 10, 0, 0)
|