From 79f5f05903cd01925001afb183ad8e32bfbd438a Mon Sep 17 00:00:00 2001 From: Mohamad Mohamad Date: Sun, 12 Mar 2023 19:14:16 +1100 Subject: [PATCH] fixed server calls --- src/report.py | 2 +- tests/bulk/bulk_export_test.py | 2 +- tests/server_calls.py | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/report.py b/src/report.py index 801394e..a82a7c1 100644 --- a/src/report.py +++ b/src/report.py @@ -77,6 +77,6 @@ def report_bulk_generate_v1(invoices: List[Invoice]) -> List[Report]: def report_bulk_export_v1(report_ids, report_format) -> List[ReportExport]: export = ReportExport(url="", invoice_hash="") - exports = [export] + exports = [export for _ in report_ids] return exports diff --git a/tests/bulk/bulk_export_test.py b/tests/bulk/bulk_export_test.py index 283a8e0..fbf8dcb 100644 --- a/tests/bulk/bulk_export_test.py +++ b/tests/bulk/bulk_export_test.py @@ -31,7 +31,7 @@ def test_bulk_export_valid(): report_ids = invoice_file_upload_bulk_v1(invoices) - exports = report_bulk_export_v1(report_ids, Format(format="HTML")) + exports = report_bulk_export_v1(report_ids, Format(format="HTML")) # type: ignore # Checking that the number of exports returned is the same as the number of invoices inputted assert len(exports) == len(report_ids) == len(invoices) diff --git a/tests/server_calls.py b/tests/server_calls.py index 78fb937..37fb3dd 100644 --- a/tests/server_calls.py +++ b/tests/server_calls.py @@ -36,9 +36,7 @@ def invoice_upload_file_v1(invoice_name: str, invoice_filename) -> Server_call_r return json.loads(response.text) def invoice_file_upload_bulk_v1(invoices: List[Invoice]) -> Server_call_return: - payload = { - "invoices": [invoice.dict() for invoice in invoices] - } + payload = [invoice.dict() for invoice in invoices] response = requests.post(full_url + 'invoice/file_upload_bulk/v1', json=payload) return json.loads(response.text) @@ -110,7 +108,7 @@ def report_peppol_v1(invoice: Invoice) -> Server_call_return: def report_bulk_export_v1(report_ids: List[int], report_format: Format) -> Server_call_return: payload = { "report_ids": report_ids, - "report_format": report_format.format + "report_format": report_format.dict() } response = requests.get(full_url + 'report/bulk_export/v1', json=payload)