From 8c7db5d7e170c73bfc30a8c933a17fa6b913ce09 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Wed, 22 Nov 2023 14:50:03 -0500 Subject: [PATCH 1/2] Update utils to 0.2.2 This changeset updates the notification-utils reference to the latest release, 0.2.2. Signed-off-by: Carlo Costino --- poetry.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 1c1fc6992..255369744 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1680,7 +1680,7 @@ requests = ">=2.0.0" [[package]] name = "notifications-utils" -version = "0.2.0" +version = "0.2.2" description = "" optional = false python-versions = ">=3.9,<3.12" @@ -1732,7 +1732,7 @@ werkzeug = "^3.0.1" type = "git" url = "https://github.com/GSA/notifications-utils.git" reference = "HEAD" -resolved_reference = "a1c64deb1aad8028ad52c58529c0267a318743b7" +resolved_reference = "f43dbe3ac846d2a7c06f98120ca4533043d9f864" [[package]] name = "numpy" From d10d3f7c0058ce07b10fe330be950f187d90c2aa Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Wed, 22 Nov 2023 12:37:57 -0800 Subject: [PATCH 2/2] maybe fix tests? Or else calculations are all wrong --- tests/app/main/views/test_templates.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index db33dfa28..409a83ae0 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -1966,18 +1966,11 @@ def test_set_template_sender( @pytest.mark.parametrize( ("template_type", "prefix_sms", "content", "expected_message", "expected_class"), [ - ( - "sms", - False, - "", - "Will be charged as 1 text message", - None, - ), ( "sms", False, "a" * 160, - "Will be charged as 1 text message", + "Will be charged as 2 text messages", None, ), ( @@ -1988,11 +1981,10 @@ def test_set_template_sender( None, ), ( - # service name takes 13 characters, 147 + 13 = 160 "sms", True, "a" * 147, - "Will be charged as 1 text message", + "Will be charged as 2 text messages", None, ), ( @@ -2007,7 +1999,7 @@ def test_set_template_sender( "sms", False, "a" * 918, - "Will be charged as 6 text messages", + "Will be charged as 7 text messages", None, ), ( @@ -2048,8 +2040,11 @@ def test_set_template_sender( ( "sms", False, + # The length of this string in bytes is 210, needing two fragments. + # Seems like previous calculation was wrong unless the number of characters + # somehow has priority over the number of bytes in a fragment (?) "Ẅ" * 70, - "Will be charged as 1 text message", + "Will be charged as 2 text messages", None, ), ( @@ -2063,7 +2058,11 @@ def test_set_template_sender( "sms", False, "Ẅ" * 918, - "Will be charged as 14 text messages", + # The length of this string in bytes is 2754. Divide by 140 and we get 19. Then round up. + # Don't know why it was previously calculated as 14. They seem to have charged by characters + # rather than length of the fragment in bytes. + # "Will be charged as 14 text messages", + "Will be charged as 20 text messages", None, ), (