From c7e05246b13199783ece0d8a24163ac762488560 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Mon, 2 Oct 2023 15:12:36 -0400 Subject: [PATCH 1/2] 808 - formatted annual usage section --- app/templates/views/usage.html | 15 ++++++++----- tests/app/main/views/test_dashboard.py | 31 ++++++++++++++------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/templates/views/usage.html b/app/templates/views/usage.html index 5f0654ff3..2b4be5415 100644 --- a/app/templates/views/usage.html +++ b/app/templates/views/usage.html @@ -20,15 +20,18 @@
-
+

Text messages

- {{ big_number(sms_sent, 'sent', smaller=True) }} - {{ big_number(sms_free_allowance, 'free allowance', smaller=True) }} + You have sent + {{ big_number(sms_sent, 'messages of your', smaller=True) }} + {{ big_number(sms_free_allowance, 'free messages allowance.', smaller=True) }} +
+ You have {% if sms_free_allowance > 0 %} - {{ big_number(sms_allowance_remaining, 'free allowance remaining', smaller=True) }} + {{ big_number(sms_allowance_remaining, 'messages remaining.', smaller=True) }} {% endif %} - {% for row in sms_breakdown %} + {# {% for row in sms_breakdown %} {% if row.charged_units > 0 %} {{ big_number( row.charged_units, @@ -36,7 +39,7 @@ smaller=True ) }} {% endif %} - {% endfor %} + {% endfor %} #}
{#
diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 69f8115fe..4871caea8 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -819,7 +819,7 @@ def test_usage_page( assert normalize_spaces(unselected_nav_links[0].text) == "2010 to 2011 fiscal year" assert normalize_spaces(unselected_nav_links[1].text) == "2009 to 2010 fiscal year" - annual_usage = page.find_all("div", {"class": "grid-col-6"}) + annual_usage = page.find_all("div", {"class": "keyline-block"}) # annual stats are shown in two rows, each with three column; email is col 1 # email_column = normalize_spaces(annual_usage[0].text + annual_usage[2].text) @@ -827,13 +827,13 @@ def test_usage_page( # assert '1,000 sent' in email_column sms_column = normalize_spaces(annual_usage[0].text) - assert "Text messages" in sms_column - assert "251,800 sent" in sms_column - assert "250,000 free allowance" in sms_column - assert "0 free allowance remaining" in sms_column + assert ( + "You have sent 251,800 messages of your 250,000 free messages allowance. You have 0 messages remaining." + in sms_column + ) assert "$29.85 spent" not in sms_column - assert "1,500 at 1.65 pence" in sms_column - assert "300 at 1.70 pence" in sms_column + assert "1,500 at 1.65 pence" not in sms_column + assert "300 at 1.70 pence" not in sms_column @freeze_time("2012-03-31 12:12:12") @@ -862,12 +862,12 @@ def test_usage_page_no_sms_spend( service_id=SERVICE_ONE_ID, ) - annual_usage = page.find_all("div", {"class": "grid-col-6"}) + annual_usage = page.find_all("div", {"class": "keyline-block"}) sms_column = normalize_spaces(annual_usage[0].text) - assert "Text messages" in sms_column - assert "1,000 sent" in sms_column - assert "250,000 free allowance" in sms_column - assert "249,000 free allowance remaining" in sms_column + assert ( + "You have sent 1,000 messages of your 250,000 free messages allowance. You have 249,000 messages remaining." + in sms_column + ) assert "$0.00 spent" not in sms_column assert "pence per message" not in sms_column @@ -938,10 +938,13 @@ def test_usage_page_with_0_free_allowance( year=2020, ) - annual_usage = page.select("main .grid-col-6") + annual_usage = page.select("main .grid-col-12 .keyline-block") sms_column = normalize_spaces(annual_usage[0].text) - assert "0 free allowance" in sms_column + assert ( + "You have sent 251,800 messages of your 0 free messages allowance. You have" + in sms_column + ) assert "free allowance remaining" not in sms_column From e8ed0ef8b0f37f8f8ad6e0cd7a328647c550fe7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 04:14:22 +0000 Subject: [PATCH 2/2] Bump urllib3 from 1.26.16 to 1.26.17 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.16 to 1.26.17. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.16...1.26.17) --- updated-dependencies: - dependency-name: urllib3 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 92ddbb43f..8cda8034f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3270,17 +3270,17 @@ files = [ [[package]] name = "urllib3" -version = "1.26.16" +version = "1.26.17" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" files = [ - {file = "urllib3-1.26.16-py2.py3-none-any.whl", hash = "sha256:8d36afa7616d8ab714608411b4a3b13e58f463aee519024578e062e141dce20f"}, - {file = "urllib3-1.26.16.tar.gz", hash = "sha256:8f135f6502756bde6b2a9b28989df5fbe87c9970cecaa69041edcce7f0589b14"}, + {file = "urllib3-1.26.17-py2.py3-none-any.whl", hash = "sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b"}, + {file = "urllib3-1.26.17.tar.gz", hash = "sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21"}, ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]