Renamed the constants to be upper-cased in test_account.py.

This commit is contained in:
依瑪貓 2023-03-22 00:23:49 +08:00
parent d0d2d77a2e
commit 623313b58a

View File

@ -54,15 +54,15 @@ class AccountData:
"""The code."""
cash: AccountData = AccountData("1111", 1, "Cash")
CASH: AccountData = AccountData("1111", 1, "Cash")
"""The cash account."""
petty: AccountData = AccountData("1112", 1, "Bank")
PETTY: AccountData = AccountData("1112", 1, "Bank")
"""The petty cash account."""
bank: AccountData = AccountData("1113", 1, "Bank")
BANK: AccountData = AccountData("1113", 1, "Bank")
"""The bank account."""
stock: AccountData = AccountData("1121", 1, "Stock")
STOCK: AccountData = AccountData("1121", 1, "Stock")
"""The stock account."""
loan: AccountData = AccountData("2112", 1, "Loan")
LOAN: AccountData = AccountData("2112", 1, "Loan")
"""The loan account."""
PREFIX: str = "/accounting/accounts"
"""The URL prefix for the account management."""
@ -150,19 +150,19 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(f"{PREFIX}/store",
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": cash.title})
"base_code": CASH.base_code,
"title": CASH.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{cash.code}")
f"{PREFIX}/{CASH.code}")
response = self.client.post(f"{PREFIX}/store",
data={"csrf_token": self.csrf_token,
"base_code": bank.base_code,
"title": bank.title})
"base_code": BANK.base_code,
"title": BANK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{bank.code}")
f"{PREFIX}/{BANK.code}")
def test_nobody(self) -> None:
"""Test the permission as nobody.
@ -176,7 +176,7 @@ class AccountTestCase(unittest.TestCase):
response = client.get(PREFIX)
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/{cash.code}")
response = client.get(f"{PREFIX}/{CASH.code}")
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/create")
@ -184,30 +184,30 @@ class AccountTestCase(unittest.TestCase):
response = client.post(f"{PREFIX}/store",
data={"csrf_token": csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/{cash.code}/edit")
response = client.get(f"{PREFIX}/{CASH.code}/edit")
self.assertEqual(response.status_code, 403)
response = client.post(f"{PREFIX}/{cash.code}/update",
response = client.post(f"{PREFIX}/{CASH.code}/update",
data={"csrf_token": csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-2"})
self.assertEqual(response.status_code, 403)
response = client.post(f"{PREFIX}/{bank.code}/delete",
response = client.post(f"{PREFIX}/{BANK.code}/delete",
data={"csrf_token": csrf_token})
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/bases/{cash.base_code}")
response = client.get(f"{PREFIX}/bases/{CASH.base_code}")
self.assertEqual(response.status_code, 403)
with self.app.app_context():
cash_id: int = Account.find_by_code(cash.code).id
cash_id: int = Account.find_by_code(CASH.code).id
response = client.post(f"{PREFIX}/bases/{cash.base_code}",
response = client.post(f"{PREFIX}/bases/{CASH.base_code}",
data={"csrf_token": csrf_token,
"next": NEXT_URI,
f"{cash_id}-no": "5"})
@ -225,7 +225,7 @@ class AccountTestCase(unittest.TestCase):
response = client.get(PREFIX)
self.assertEqual(response.status_code, 200)
response = client.get(f"{PREFIX}/{cash.code}")
response = client.get(f"{PREFIX}/{CASH.code}")
self.assertEqual(response.status_code, 200)
response = client.get(f"{PREFIX}/create")
@ -233,30 +233,30 @@ class AccountTestCase(unittest.TestCase):
response = client.post(f"{PREFIX}/store",
data={"csrf_token": csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/{cash.code}/edit")
response = client.get(f"{PREFIX}/{CASH.code}/edit")
self.assertEqual(response.status_code, 403)
response = client.post(f"{PREFIX}/{cash.code}/update",
response = client.post(f"{PREFIX}/{CASH.code}/update",
data={"csrf_token": csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-2"})
self.assertEqual(response.status_code, 403)
response = client.post(f"{PREFIX}/{bank.code}/delete",
response = client.post(f"{PREFIX}/{BANK.code}/delete",
data={"csrf_token": csrf_token})
self.assertEqual(response.status_code, 403)
response = client.get(f"{PREFIX}/bases/{cash.base_code}")
response = client.get(f"{PREFIX}/bases/{CASH.base_code}")
self.assertEqual(response.status_code, 200)
with self.app.app_context():
cash_id: int = Account.find_by_code(cash.code).id
cash_id: int = Account.find_by_code(CASH.code).id
response = client.post(f"{PREFIX}/bases/{cash.base_code}",
response = client.post(f"{PREFIX}/bases/{CASH.base_code}",
data={"csrf_token": csrf_token,
"next": NEXT_URI,
f"{cash_id}-no": "5"})
@ -273,7 +273,7 @@ class AccountTestCase(unittest.TestCase):
response = self.client.get(PREFIX)
self.assertEqual(response.status_code, 200)
response = self.client.get(f"{PREFIX}/{cash.code}")
response = self.client.get(f"{PREFIX}/{CASH.code}")
self.assertEqual(response.status_code, 200)
response = self.client.get(f"{PREFIX}/create")
@ -281,34 +281,34 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(f"{PREFIX}/store",
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{stock.code}")
f"{PREFIX}/{STOCK.code}")
response = self.client.get(f"{PREFIX}/{cash.code}/edit")
response = self.client.get(f"{PREFIX}/{CASH.code}/edit")
self.assertEqual(response.status_code, 200)
response = self.client.post(f"{PREFIX}/{cash.code}/update",
response = self.client.post(f"{PREFIX}/{CASH.code}/update",
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-2"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], f"{PREFIX}/{cash.code}")
self.assertEqual(response.headers["Location"], f"{PREFIX}/{CASH.code}")
response = self.client.post(f"{PREFIX}/{bank.code}/delete",
response = self.client.post(f"{PREFIX}/{BANK.code}/delete",
data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], PREFIX)
response = self.client.get(f"{PREFIX}/bases/{cash.base_code}")
response = self.client.get(f"{PREFIX}/bases/{CASH.base_code}")
self.assertEqual(response.status_code, 200)
with self.app.app_context():
cash_id: int = Account.find_by_code(cash.code).id
cash_id: int = Account.find_by_code(CASH.code).id
response = self.client.post(f"{PREFIX}/bases/{cash.base_code}",
response = self.client.post(f"{PREFIX}/bases/{CASH.base_code}",
data={"csrf_token": self.csrf_token,
"next": NEXT_URI,
f"{cash_id}-no": "5"})
@ -323,31 +323,31 @@ class AccountTestCase(unittest.TestCase):
from accounting.models import Account
create_uri: str = f"{PREFIX}/create"
store_uri: str = f"{PREFIX}/store"
detail_uri: str = f"{PREFIX}/{stock.code}"
detail_uri: str = f"{PREFIX}/{STOCK.code}"
response: httpx.Response
with self.app.app_context():
self.assertEqual({x.code for x in Account.query.all()},
{cash.code, bank.code})
{CASH.code, BANK.code})
# Missing CSRF token
response = self.client.post(store_uri,
data={"base_code": stock.base_code,
"title": stock.title})
data={"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 400)
# CSRF token mismatch
response = self.client.post(store_uri,
data={"csrf_token": f"{self.csrf_token}-2",
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 400)
# Empty base account code
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": " ",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], create_uri)
@ -355,7 +355,7 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": "9999",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], create_uri)
@ -363,14 +363,14 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": "1",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], create_uri)
# Empty name
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"base_code": STOCK.base_code,
"title": " "})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], create_uri)
@ -379,7 +379,7 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": "6172",
"title": stock.title,
"title": STOCK.title,
"is_need_offset": "yes"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], create_uri)
@ -387,43 +387,43 @@ class AccountTestCase(unittest.TestCase):
# Success, with spaces to be stripped
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": f" {stock.base_code} ",
"title": f" {stock.title} "})
"base_code": f" {STOCK.base_code} ",
"title": f" {STOCK.title} "})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
# Success under the same base
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{stock.base_code}-002")
f"{PREFIX}/{STOCK.base_code}-002")
# Success under the same base, with order in a mess.
with self.app.app_context():
stock_2: Account = Account.find_by_code(f"{stock.base_code}-002")
stock_2: Account = Account.find_by_code(f"{STOCK.base_code}-002")
stock_2.no = 66
db.session.commit()
response = self.client.post(store_uri,
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{stock.base_code}-003")
f"{PREFIX}/{STOCK.base_code}-003")
with self.app.app_context():
self.assertEqual({x.code for x in Account.query.all()},
{cash.code, bank.code, stock.code,
f"{stock.base_code}-002",
f"{stock.base_code}-003"})
{CASH.code, BANK.code, STOCK.code,
f"{STOCK.base_code}-002",
f"{STOCK.base_code}-003"})
account: Account = Account.find_by_code(stock.code)
self.assertEqual(account.base_code, stock.base_code)
self.assertEqual(account.title_l10n, stock.title)
account: Account = Account.find_by_code(STOCK.code)
self.assertEqual(account.base_code, STOCK.base_code)
self.assertEqual(account.title_l10n, STOCK.title)
def test_basic_update(self) -> None:
"""Tests the basic rules to update a user.
@ -431,30 +431,30 @@ class AccountTestCase(unittest.TestCase):
:return: None.
"""
from accounting.models import Account
detail_uri: str = f"{PREFIX}/{cash.code}"
edit_uri: str = f"{PREFIX}/{cash.code}/edit"
update_uri: str = f"{PREFIX}/{cash.code}/update"
detail_c_uri: str = f"{PREFIX}/{stock.code}"
detail_uri: str = f"{PREFIX}/{CASH.code}"
edit_uri: str = f"{PREFIX}/{CASH.code}/edit"
update_uri: str = f"{PREFIX}/{CASH.code}/update"
detail_c_uri: str = f"{PREFIX}/{STOCK.code}"
response: httpx.Response
# Success, with spaces to be stripped
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": f" {cash.base_code} ",
"title": f" {cash.title}-1 "})
"base_code": f" {CASH.base_code} ",
"title": f" {CASH.title}-1 "})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account: Account = Account.find_by_code(cash.code)
self.assertEqual(account.base_code, cash.base_code)
self.assertEqual(account.title_l10n, f"{cash.title}-1")
account: Account = Account.find_by_code(CASH.code)
self.assertEqual(account.base_code, CASH.base_code)
self.assertEqual(account.title_l10n, f"{CASH.title}-1")
# Empty base account code
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": " ",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], edit_uri)
@ -462,7 +462,7 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": "9999",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], edit_uri)
@ -470,14 +470,14 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": "1",
"title": stock.title})
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], edit_uri)
# Empty name
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"base_code": STOCK.base_code,
"title": " "})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], edit_uri)
@ -486,7 +486,7 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": "6172",
"title": stock.title,
"title": STOCK.title,
"is_need_offset": "yes"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], edit_uri)
@ -494,8 +494,8 @@ class AccountTestCase(unittest.TestCase):
# Change the base account
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": stock.base_code,
"title": stock.title})
"base_code": STOCK.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_c_uri)
@ -511,20 +511,20 @@ class AccountTestCase(unittest.TestCase):
:return: None.
"""
from accounting.models import Account
detail_uri: str = f"{PREFIX}/{cash.code}"
update_uri: str = f"{PREFIX}/{cash.code}/update"
detail_uri: str = f"{PREFIX}/{CASH.code}"
update_uri: str = f"{PREFIX}/{CASH.code}/update"
account: Account
response: httpx.Response
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": f" {cash.base_code} ",
"title": f" {cash.title} "})
"base_code": f" {CASH.base_code} ",
"title": f" {CASH.title} "})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
account = Account.find_by_code(CASH.code)
self.assertIsNotNone(account)
account.created_at \
= account.created_at - timedelta(seconds=5)
@ -533,13 +533,13 @@ class AccountTestCase(unittest.TestCase):
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": stock.title})
"base_code": CASH.base_code,
"title": STOCK.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
account = Account.find_by_code(CASH.code)
self.assertIsNotNone(account)
self.assertLess(account.created_at,
account.updated_at)
@ -552,25 +552,25 @@ class AccountTestCase(unittest.TestCase):
from accounting.models import Account
editor_username, editor2_username = "editor", "editor2"
client, csrf_token = get_client(self.app, editor2_username)
detail_uri: str = f"{PREFIX}/{cash.code}"
update_uri: str = f"{PREFIX}/{cash.code}/update"
detail_uri: str = f"{PREFIX}/{CASH.code}"
update_uri: str = f"{PREFIX}/{CASH.code}/update"
account: Account
response: httpx.Response
with self.app.app_context():
account = Account.find_by_code(cash.code)
account = Account.find_by_code(CASH.code)
self.assertEqual(account.created_by.username, editor_username)
self.assertEqual(account.updated_by.username, editor_username)
response = client.post(update_uri,
data={"csrf_token": csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-2"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
account = Account.find_by_code(CASH.code)
self.assertEqual(account.created_by.username,
editor_username)
self.assertEqual(account.updated_by.username,
@ -582,60 +582,60 @@ class AccountTestCase(unittest.TestCase):
:return: None
"""
from accounting.models import Account
detail_uri: str = f"{PREFIX}/{cash.code}"
update_uri: str = f"{PREFIX}/{cash.code}/update"
detail_uri: str = f"{PREFIX}/{CASH.code}"
update_uri: str = f"{PREFIX}/{CASH.code}/update"
account: Account
response: httpx.Response
with self.app.app_context():
account = Account.find_by_code(cash.code)
self.assertEqual(account.title_l10n, cash.title)
account = Account.find_by_code(CASH.code)
self.assertEqual(account.title_l10n, CASH.title)
self.assertEqual(account.l10n, [])
set_locale(self.client, self.csrf_token, "zh_Hant")
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-zh_Hant"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-zh_Hant"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
self.assertEqual(account.title_l10n, cash.title)
account = Account.find_by_code(CASH.code)
self.assertEqual(account.title_l10n, CASH.title)
self.assertEqual({(x.locale, x.title) for x in account.l10n},
{("zh_Hant", f"{cash.title}-zh_Hant")})
{("zh_Hant", f"{CASH.title}-zh_Hant")})
set_locale(self.client, self.csrf_token, "en")
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-2"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
self.assertEqual(account.title_l10n, f"{cash.title}-2")
account = Account.find_by_code(CASH.code)
self.assertEqual(account.title_l10n, f"{CASH.title}-2")
self.assertEqual({(x.locale, x.title) for x in account.l10n},
{("zh_Hant", f"{cash.title}-zh_Hant")})
{("zh_Hant", f"{CASH.title}-zh_Hant")})
set_locale(self.client, self.csrf_token, "zh_Hant")
response = self.client.post(update_uri,
data={"csrf_token": self.csrf_token,
"base_code": cash.base_code,
"title": f"{cash.title}-zh_Hant-2"})
"base_code": CASH.base_code,
"title": f"{CASH.title}-zh_Hant-2"})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"], detail_uri)
with self.app.app_context():
account = Account.find_by_code(cash.code)
self.assertEqual(account.title_l10n, f"{cash.title}-2")
account = Account.find_by_code(CASH.code)
self.assertEqual(account.title_l10n, f"{CASH.title}-2")
self.assertEqual({(x.locale, x.title) for x in account.l10n},
{("zh_Hant", f"{cash.title}-zh_Hant-2")})
{("zh_Hant", f"{CASH.title}-zh_Hant-2")})
def test_delete(self) -> None:
"""Tests to delete a currency.
@ -643,18 +643,18 @@ class AccountTestCase(unittest.TestCase):
:return: None.
"""
from accounting.models import Account
detail_uri: str = f"{PREFIX}/{bank.code}"
delete_uri: str = f"{PREFIX}/{bank.code}/delete"
detail_uri: str = f"{PREFIX}/{BANK.code}"
delete_uri: str = f"{PREFIX}/{BANK.code}/delete"
list_uri: str = PREFIX
response: httpx.Response
response = self.client.post(f"{PREFIX}/store",
data={"csrf_token": self.csrf_token,
"base_code": petty.base_code,
"title": petty.title})
"base_code": PETTY.base_code,
"title": PETTY.title})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{petty.code}")
f"{PREFIX}/{PETTY.code}")
response = self.client.post("/accounting/currencies/store",
data={"csrf_token": self.csrf_token,
@ -669,26 +669,26 @@ class AccountTestCase(unittest.TestCase):
"next": NEXT_URI,
"date": date.today().isoformat(),
"currency-1-code": "USD",
"currency-1-credit-1-account_code": petty.code,
"currency-1-credit-1-account_code": PETTY.code,
"currency-1-credit-1-amount": "20"})
with self.app.app_context():
self.assertEqual({x.code for x in Account.query.all()},
{cash.code, petty.code, bank.code})
{CASH.code, PETTY.code, BANK.code})
# Cannot delete the cash account
response = self.client.post(f"{PREFIX}/{cash.code}/delete",
response = self.client.post(f"{PREFIX}/{CASH.code}/delete",
data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{cash.code}")
f"{PREFIX}/{CASH.code}")
# Cannot delete the account that is in use
response = self.client.post(f"{PREFIX}/{petty.code}/delete",
response = self.client.post(f"{PREFIX}/{PETTY.code}/delete",
data={"csrf_token": self.csrf_token})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.headers["Location"],
f"{PREFIX}/{petty.code}")
f"{PREFIX}/{PETTY.code}")
# Success
response = self.client.get(detail_uri)
@ -700,7 +700,7 @@ class AccountTestCase(unittest.TestCase):
with self.app.app_context():
self.assertEqual({x.code for x in Account.query.all()},
{cash.code, petty.code})
{CASH.code, PETTY.code})
response = self.client.get(detail_uri)
self.assertEqual(response.status_code, 404)