Added match_uri to the tests of the OffsetMatcherTestCase test case, for readability.

This commit is contained in:
依瑪貓 2023-04-09 08:25:34 +08:00
parent 6857164702
commit 9f7bb6b9de

View File

@ -79,6 +79,7 @@ class OffsetMatcherTestCase(unittest.TestCase):
line_item: JournalEntryLineItem | None line_item: JournalEntryLineItem | None
matcher: OffsetMatcher matcher: OffsetMatcher
list_uri: str list_uri: str
match_uri: str
response: httpx.Response response: httpx.Response
# The receivables # The receivables
@ -104,7 +105,8 @@ class OffsetMatcherTestCase(unittest.TestCase):
self.assertIsNone(line_item.original_line_item_id) self.assertIsNone(line_item.original_line_item_id)
list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}" list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}"
response = self.client.post(list_uri, match_uri = f"{PREFIX}/{Accounts.RECEIVABLE}"
response = self.client.post(match_uri,
data={"csrf_token": self.csrf_token}) data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], list_uri) self.assertEqual(response.headers["Location"], list_uri)
@ -153,7 +155,8 @@ class OffsetMatcherTestCase(unittest.TestCase):
self.assertIsNone(line_item.original_line_item_id) self.assertIsNone(line_item.original_line_item_id)
list_uri = f"{PREFIX}/{Accounts.PAYABLE}" list_uri = f"{PREFIX}/{Accounts.PAYABLE}"
response = self.client.post(list_uri, match_uri = f"{PREFIX}/{Accounts.PAYABLE}"
response = self.client.post(match_uri,
data={"csrf_token": self.csrf_token}) data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], list_uri) self.assertEqual(response.headers["Location"], list_uri)
@ -192,6 +195,7 @@ class OffsetMatcherTestCase(unittest.TestCase):
line_item: JournalEntryLineItem | None line_item: JournalEntryLineItem | None
matcher: OffsetMatcher matcher: OffsetMatcher
list_uri: str list_uri: str
match_uri: str
response: httpx.Response response: httpx.Response
# The receivables # The receivables
@ -224,7 +228,8 @@ class OffsetMatcherTestCase(unittest.TestCase):
self.assertEqual(line_item.original_line_item_id, data.l_r_or2d.id) self.assertEqual(line_item.original_line_item_id, data.l_r_or2d.id)
list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}" list_uri = f"{PREFIX}/{Accounts.RECEIVABLE}"
response = self.client.post(list_uri, match_uri = f"{PREFIX}/{Accounts.RECEIVABLE}"
response = self.client.post(match_uri,
data={"csrf_token": self.csrf_token}) data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], list_uri) self.assertEqual(response.headers["Location"], list_uri)
@ -289,7 +294,8 @@ class OffsetMatcherTestCase(unittest.TestCase):
self.assertEqual(line_item.original_line_item_id, data.l_p_or2c.id) self.assertEqual(line_item.original_line_item_id, data.l_p_or2c.id)
list_uri = f"{PREFIX}/{Accounts.PAYABLE}" list_uri = f"{PREFIX}/{Accounts.PAYABLE}"
response = self.client.post(list_uri, match_uri = f"{PREFIX}/{Accounts.PAYABLE}"
response = self.client.post(match_uri,
data={"csrf_token": self.csrf_token}) data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], list_uri) self.assertEqual(response.headers["Location"], list_uri)