|
1 | | -import json |
2 | 1 | import base64 |
3 | 2 | import hashlib |
| 3 | +import json |
4 | 4 | import unittest |
5 | 5 | from dataclasses import dataclass |
6 | 6 | from typing import Any, cast |
@@ -457,8 +457,15 @@ def test_export_workflow_reads_hash_requirement_from_client_options(self): |
457 | 457 | class DummyInvoices: |
458 | 458 | pass |
459 | 459 |
|
460 | | - http = RecordingHttp() |
461 | | - setattr(http, "_options", KsefClientOptions(base_url="https://api-test.ksef.mf.gov.pl", require_export_part_hash=False)) |
| 460 | + class RecordingHttpWithOptions(RecordingHttp): |
| 461 | + def __init__(self) -> None: |
| 462 | + super().__init__() |
| 463 | + self._options = KsefClientOptions( |
| 464 | + base_url="https://api-test.ksef.mf.gov.pl", |
| 465 | + require_export_part_hash=False, |
| 466 | + ) |
| 467 | + |
| 468 | + http = RecordingHttpWithOptions() |
462 | 469 | workflow = workflows.ExportWorkflow(cast(InvoicesClient, DummyInvoices()), http) |
463 | 470 | with patch.object( |
464 | 471 | workflow._download_helper, |
@@ -711,7 +718,10 @@ class DummyInvoices: |
711 | 718 | "download_parts_with_hash", |
712 | 719 | AsyncMock(return_value=[(encrypted, None)]), |
713 | 720 | ): |
714 | | - result = await workflow.download_and_process_package({"parts": [{"url": "u"}]}, encryption) |
| 721 | + result = await workflow.download_and_process_package( |
| 722 | + {"parts": [{"url": "u"}]}, |
| 723 | + encryption, |
| 724 | + ) |
715 | 725 | self.assertIn("inv.xml", result.invoice_xml_files) |
716 | 726 |
|
717 | 727 | async def test_async_export_workflow_rejects_hash_mismatch(self): |
|
0 commit comments