From 88a36bc69a64db3185b7a62a8ca0ffa00f7a798b Mon Sep 17 00:00:00 2001 From: Matthew McKenzie Date: Mon, 30 Sep 2024 14:55:23 +0100 Subject: [PATCH] Update test --- commodities/tests/test_views.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/commodities/tests/test_views.py b/commodities/tests/test_views.py index 02bf7ae01..3e026ed63 100644 --- a/commodities/tests/test_views.py +++ b/commodities/tests/test_views.py @@ -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.""" @@ -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( @@ -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}/") @@ -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():