Skip to content

Commit 63dad20

Browse files
committed
fix(test): skip link-validation for terminal-transaction lifecycle tests (unrelated fixture invoice)
1 parent c937730 commit 63dad20

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

ury/ury/api/test_payment_terminal.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# See license.txt
33

44
import unittest
5+
from unittest import mock
56

67
import frappe
78

@@ -63,9 +64,20 @@ def setUp(self):
6364
).insert(ignore_permissions=True)
6465
register_payment_terminal_provider(_SimulatedPaymentTerminalProvider())
6566

67+
# The transaction log's `invoice` field link-validates against a real
68+
# POS Invoice, which is correct for production (a terminal
69+
# transaction is always tied to a real invoice) but out of scope to
70+
# fixture up here -- these tests only cover the terminal/transaction
71+
# lifecycle itself, not invoice creation. Skip link validation for
72+
# the duration of this test class rather than either weakening the
73+
# field in production or dragging in an unrelated invoice fixture.
74+
self._link_patch = mock.patch("frappe.model.document.Document._validate_links")
75+
self._link_patch.start()
76+
6677
def tearDown(self):
6778
from ury.ury.api import payment_terminal
6879

80+
self._link_patch.stop()
6981
payment_terminal._payment_terminal_provider = payment_terminal._NoOpPaymentTerminalProvider()
7082
frappe.db.delete(
7183
"URY Payment Terminal Transaction", {"terminal": self.terminal.name}

0 commit comments

Comments
 (0)