Added the test URI variables in the test_run test of the RunTestCase test case.

This commit is contained in:
依瑪貓 2022-12-06 07:07:49 +08:00
parent 353ebd7242
commit 7e7d428b52

View File

@ -76,9 +76,13 @@ class RunTestCase(unittest.TestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
today: str = datetime.today().strftime("%Y-%m-%d") today: str = datetime.today().strftime("%Y-%m-%d")
expense_add_uri: str = "/accounting/transactions/expense/create?r=/ok"
income_add_uri: str = "/accounting/transactions/income/create?r=/ok"
transfer_add_uri: str \
= "/accounting/transactions/transfer/create?r=/ok"
response = self.client.post( response = self.client.post(
"/accounting/transactions/expense/create?r=/ok", expense_add_uri,
{"date": today, {"date": today,
"debit-2-ord": 6, "debit-2-ord": 6,
"debit-2-summary": "lunch", "debit-2-summary": "lunch",
@ -90,11 +94,10 @@ class RunTestCase(unittest.TestCase):
"debit-8-account": "6273", "debit-8-account": "6273",
"notes": "yammy"}) "notes": "yammy"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertNotEqual(response.headers["Location"], self.assertNotEqual(response.headers["Location"], expense_add_uri)
"/accounting/transactions/expense/create?r=/ok")
response = self.client.post( response = self.client.post(
"/accounting/transactions/income/create?r=/ok", income_add_uri,
{"date": today, {"date": today,
"credit-3-ord": 7, "credit-3-ord": 7,
"credit-3-summary": "withdrawal", "credit-3-summary": "withdrawal",
@ -106,11 +109,10 @@ class RunTestCase(unittest.TestCase):
"credit-6-account": "4611", "credit-6-account": "4611",
"notes": "wonderful"}) "notes": "wonderful"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertNotEqual(response.headers["Location"], self.assertNotEqual(response.headers["Location"], income_add_uri)
"/accounting/transactions/income/create?r=/ok")
response = self.client.post( response = self.client.post(
"/accounting/transactions/transfer/create?r=/ok", transfer_add_uri,
{"date": today, {"date": today,
"debit-2-ord": 6, "debit-2-ord": 6,
"debit-2-summary": "lunch", "debit-2-summary": "lunch",
@ -130,11 +132,10 @@ class RunTestCase(unittest.TestCase):
"credit-6-account": "1111", "credit-6-account": "1111",
"notes": "nothing"}) "notes": "nothing"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], self.assertEqual(response.headers["Location"], transfer_add_uri)
"/accounting/transactions/transfer/create?r=/ok")
response = self.client.post( response = self.client.post(
"/accounting/transactions/transfer/create?r=/ok", transfer_add_uri,
{"date": today, {"date": today,
"debit-2-ord": 6, "debit-2-ord": 6,
"debit-2-summary": "lunch", "debit-2-summary": "lunch",
@ -154,5 +155,4 @@ class RunTestCase(unittest.TestCase):
"credit-6-account": "1111", "credit-6-account": "1111",
"notes": "nothing"}) "notes": "nothing"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertNotEqual(response.headers["Location"], self.assertNotEqual(response.headers["Location"], transfer_add_uri)
"/accounting/transactions/transfer/create?r=/ok")