Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjamc committed Sep 30, 2024
1 parent 05456a9 commit 88a36bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions commodities/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def test_commodity_list_displays_commodity_suffix_indent_and_description(
valid_user_client,
date_ranges,
):
"""Test that a list of commodity codes with links and their suffixes,
indents and descriptions are displayed on the list view template."""
Expand All @@ -37,6 +38,9 @@ def test_commodity_list_displays_commodity_suffix_indent_and_description(
description="A second commodity code description",
).described_goods_nomenclature

commodity2.valid_between = date_ranges.normal
commodity2.save(force_write=True)

url = reverse("commodity-ui-list")
response = valid_user_client.get(url)
page = BeautifulSoup(
Expand All @@ -51,6 +55,10 @@ def test_commodity_list_displays_commodity_suffix_indent_and_description(
text=commodity1.get_indent_as_at(datetime.date.today()).indent,
)
assert page.find("tbody").find("td", text="A commodity code description")
assert page.find("tbody").find(
"td",
text=f"{commodity1.valid_between.lower:%d %b %Y}",
)

assert page.find("tbody").find("td", text=commodity2.item_id)
assert page.find("tbody").find(href=f"/commodities/{commodity2.sid}/")
Expand All @@ -60,6 +68,14 @@ def test_commodity_list_displays_commodity_suffix_indent_and_description(
text=commodity2.get_indent_as_at(datetime.date.today()).indent,
)
assert page.find("tbody").find("td", text="A second commodity code description")
assert page.find("tbody").find(
"td",
text=f"{commodity2.valid_between.lower:%d %b %Y}",
)
assert page.find("tbody").find(
"td",
text=f"{commodity2.valid_between.upper:%d %b %Y}",
)


def test_commodity_list_queryset():
Expand Down

0 comments on commit 88a36bc

Please sign in to comment.