@@ -42,6 +42,28 @@ async def test_export_all_multi_sheet_excel(async_session: AsyncSession):
4242 value = 500.0 ,
4343 )
4444 async_session .add (j1 )
45+ await async_session .flush ()
46+
47+ from src .models import Quote , Invoice , QuoteStatus , InvoiceStatus
48+ import uuid
49+
50+ q1 = Quote (
51+ business_id = business .id ,
52+ customer_id = c1 .id ,
53+ title = "Test Quote" ,
54+ total_amount = 1200.0 ,
55+ status = QuoteStatus .SENT ,
56+ external_token = str (uuid .uuid4 ()),
57+ )
58+ async_session .add (q1 )
59+
60+ inv1 = Invoice (
61+ job_id = j1 .id ,
62+ status = InvoiceStatus .SENT ,
63+ s3_key = "invoices/test.pdf" ,
64+ public_url = "http://fake.url/test.pdf" ,
65+ )
66+ async_session .add (inv1 )
4567 await async_session .commit ()
4668
4769 service = DataManagementService (async_session )
@@ -53,7 +75,10 @@ async def test_export_all_multi_sheet_excel(async_session: AsyncSession):
5375
5476 # Action: Export EVERYTHING as EXCEL
5577 result = await service .export_data (
56- business_id = business .id , query = "all" , format = ExportFormat .EXCEL
78+ business_id = business .id ,
79+ query = "all" ,
80+ format = ExportFormat .EXCEL ,
81+ filters = {"entity_type" : EntityType .ALL },
5782 )
5883
5984 # Verify status
@@ -77,13 +102,19 @@ async def test_export_all_multi_sheet_excel(async_session: AsyncSession):
77102 # This will read all sheets into a dict of DataFrames
78103 xl = pd .read_excel (excel_data , sheet_name = None )
79104
80- # Check if sheets "customers" and "jobs" are present
105+ # Check if sheets are present
81106 assert "customers" in xl
82107 assert "jobs" in xl
108+ assert "quotes" in xl
109+ assert "invoices" in xl
83110
84111 # Check content of sheets
85112 customers_df = xl ["customers" ]
86113 jobs_df = xl ["jobs" ]
114+ quotes_df = xl ["quotes" ]
115+ invoices_df = xl ["invoices" ]
87116
88117 assert any (customers_df ["name" ] == "Alice Excel" )
89118 assert any (jobs_df ["description" ] == "Excel Job" )
119+ assert any (quotes_df ["title" ] == "Test Quote" )
120+ assert any (invoices_df ["amount" ] == 500.0 )
0 commit comments