From 68571647028a55aa3acb4e7dd6ef46ab7730fe20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 9 Apr 2023 08:22:25 +0800 Subject: [PATCH] Added the PREFIX constant to simplify the OffsetMatcherTestCase test case. --- tests/test_offset_matcher.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_offset_matcher.py b/tests/test_offset_matcher.py index f69a5b9..322b62a 100644 --- a/tests/test_offset_matcher.py +++ b/tests/test_offset_matcher.py @@ -30,6 +30,9 @@ from testlib_journal_entry import match_journal_entry_detail from testlib_offset import JournalEntryData, CurrencyData, \ JournalEntryLineItemData +PREFIX: str = "/accounting/unmatched-offsets" +"""The URL prefix for the unmatched offset management.""" + class OffsetMatcherTestCase(unittest.TestCase): """The offset matcher test case.""" @@ -100,7 +103,7 @@ class OffsetMatcherTestCase(unittest.TestCase): self.assertIsNotNone(line_item) self.assertIsNone(line_item.original_line_item_id) - list_uri = f"/accounting/unmatched-offsets/{Accounts.RECEIVABLE}" + list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}" response = self.client.post(list_uri, data={"csrf_token": self.csrf_token}) self.assertEqual(response.status_code, 302) @@ -149,7 +152,7 @@ class OffsetMatcherTestCase(unittest.TestCase): self.assertIsNotNone(line_item) self.assertIsNone(line_item.original_line_item_id) - list_uri = f"/accounting/unmatched-offsets/{Accounts.PAYABLE}" + list_uri = f"{PREFIX}/{Accounts.PAYABLE}" response = self.client.post(list_uri, data={"csrf_token": self.csrf_token}) self.assertEqual(response.status_code, 302) @@ -220,7 +223,7 @@ class OffsetMatcherTestCase(unittest.TestCase): self.assertIsNotNone(line_item.original_line_item_id) self.assertEqual(line_item.original_line_item_id, data.l_r_or2d.id) - list_uri = f"/accounting/unmatched-offsets/{Accounts.RECEIVABLE}" + list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}" response = self.client.post(list_uri, data={"csrf_token": self.csrf_token}) self.assertEqual(response.status_code, 302) @@ -285,7 +288,7 @@ class OffsetMatcherTestCase(unittest.TestCase): self.assertIsNotNone(line_item.original_line_item_id) self.assertEqual(line_item.original_line_item_id, data.l_p_or2c.id) - list_uri = f"/accounting/unmatched-offsets/{Accounts.PAYABLE}" + list_uri = f"{PREFIX}/{Accounts.PAYABLE}" response = self.client.post(list_uri, data={"csrf_token": self.csrf_token}) self.assertEqual(response.status_code, 302)