Sign in before filtering the order export
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from slips.crm_orders import (
|
||||
SESSION_TTL_SECONDS,
|
||||
CrmAuthError,
|
||||
CrmOrdersError,
|
||||
_load_order_export,
|
||||
code_matches,
|
||||
export_filtered_customer_orders,
|
||||
format_jalali,
|
||||
@@ -192,6 +193,32 @@ class SystemGroupLoginTests(unittest.TestCase):
|
||||
self.assertIn("PageID=", sess.gets[0])
|
||||
self.assertIn("TimeStamp=", sess.gets[0])
|
||||
|
||||
def test_filtered_export_logs_in_first(self):
|
||||
calls = []
|
||||
|
||||
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")
|
||||
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()
|
||||
|
||||
|
||||
class CrmSessionTests(TestCase):
|
||||
def test_session_lasts_thirty_days_and_slides(self):
|
||||
|
||||
Reference in New Issue
Block a user