Download the full order CSV instead of re-running the report

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-22 08:34:27 +03:30
parent 2bf8c046c6
commit 0fa05ab48d
2 changed files with 15 additions and 34 deletions

View File

@@ -156,31 +156,17 @@ class SystemGroupLoginTests(unittest.TestCase):
self.assertEqual(posted["filterItemName"], "pp.code")
self.assertEqual(posted["operands"][0]["value"], "KR")
def test_filtered_export_logs_in_first(self):
calls = []
def test_load_uses_direct_export(self):
seen = {}
class Client:
def __init__(self):
self.session = object()
self._logged_in = False
def login(self):
calls.append("login")
self._logged_in = True
def fetch_customer_orders(self):
calls.append("full")
def fetch_customer_orders(self, **kwargs):
seen.update(kwargs)
return "full", "text/csv"
client = Client()
with patch(
"slips.crm_orders.export_filtered_customer_orders",
return_value=("filtered", "text/csv"),
) as filtered:
body, ctype = _load_order_export(client, date(2026, 3, 21), ["KR"])
self.assertEqual(calls, ["login"])
self.assertEqual((body, ctype), ("filtered", "text/csv"))
filtered.assert_called_once()
body, ctype = _load_order_export(Client(), date(2026, 3, 21), ["KR"])
self.assertEqual((body, ctype), ("full", "text/csv"))
self.assertNotIn("filter_state", seen)
class CrmSessionTests(TestCase):