Commit Graph

4284 Commits

Author SHA1 Message Date
Ben Thorner
fa01889d01 Rearrange branding tests to group email / letters
Previously I found it hard to audit these tests when they flipped
between emails and letters when scrolling vertically.

While these have much in common, they are still separate features
and will evolve separately.
2022-03-30 17:46:52 +01:00
Ben Thorner
543dff4a18 Remove redundant scenario for email branding test
This is no longer possible since [^1].

[^1]: https://github.com/alphagov/notifications-admin/pull/4180
2022-03-30 17:46:51 +01:00
Ben Thorner
e2929118c8 Remove redundant letter branding UI test
This is now covered by the unit tests for the new branding module.
Showing the "something else" text box is also already covered by
another UI test, so we don't need it for that either.
2022-03-30 17:46:50 +01:00
Ben Thorner
1a7ecd85c9 Add tests for branding options conditional on name 2022-03-30 17:46:49 +01:00
Ben Thorner
15247bd780 Add missing test cases for default branding 2022-03-30 17:46:48 +01:00
Ben Thorner
3beb56be57 DRY-up tests by parametrizing on existing branding
This is possible now we're testing letters and emails separately.
I've added a few missing cases for NHS and non-central branding.
In the next commits we'll look at the remaining special cases.
2022-03-30 17:46:47 +01:00
Ben Thorner
330c23ad30 Remove excess tests for other org types
These all behave the same as each other so there's little value in
testing all of them - if we had 100 org types we wouldn't test them
all, but it's easy to get carried away when there are fewer.
2022-03-30 17:46:46 +01:00
Ben Thorner
e7d59263d1 Split out tests for letter and email branding
This also fills a gap where we weren't checking the central org
case for letters.
2022-03-30 17:46:45 +01:00
Ben Thorner
1cc5413f96 Move and clarify "NHS_BRANDING_ID" constant
This is specific to email branding [^1]. Using the name to match
the current branding is more error-prone.

[^1]: a165f62b60
2022-03-30 17:46:41 +01:00
Ben Thorner
8f55972aae Split "get_available_choices" by branding type
We already had different functionality for email branding and will
soon be adding more for email branding pools.

Note that the "get_available_choices" class method was only used for
email branding - we can do it in the constructor for letters.
2022-03-30 17:46:39 +01:00
Pea Tyczynska
7d5ca324d0 Merge pull request #4166 from alphagov/allow_user_delete_mobile_number
Let users on email auth delete their mobile numbers
2022-03-25 16:02:38 +00:00
Pea Tyczynska
190381c578 Make sure delete mobile number only shown when needed
Users who have no mobile number set, users who are not on email auth
and users who are not on "Change mobile number" page should not
see the delete link.
2022-03-25 15:49:03 +00:00
Ben Thorner
3a6ceac910 Merge pull request #4198 from alphagov/service-history-link
Show link to service history in the settings page
2022-03-25 09:49:00 +00:00
Ben Thorner
422b4c1091 Show link to service history in the settings page
Based on discussion in [^1].

[^1]: https://github.com/alphagov/notifications-admin/pull/4157
2022-03-24 12:58:56 +00:00
Ben Thorner
808f248782 Rename "page-footer-delete-link" class
This doesn't set any deletion-specific attributes so it's valid to
just call it "page-footer-link".
2022-03-24 12:58:08 +00:00
Ben Thorner
b6bc598e8c Make it easy to see API keys for broadcast service
This made it easier to debug a problem with the functional tests
due to the fixtures not working correctly [^1]. It's a platform
admin only convenience over knowing the page URL.

We may want to expose the top-level "/api-integration" page but
that will require more work to show which broadcasts were sent with
which key - currently it's oriented around "messages". For now I
think it's useful to see what keys a service has.

[^1]: https://github.com/alphagov/notifications-functional-tests/pull/411#pullrequestreview-920069799
2022-03-24 12:33:09 +00:00
Ben Thorner
dd85cf076d Fix test for broadcast service with realistic user
Previously the user had permissions like "manage_users", which can't
currently be set in the UI.
2022-03-24 12:32:43 +00:00
Ben Thorner
411abb136a Make broadcast user fixtures realistic
A broadcast service user will have the permission on creation [^1].

[^1]: b145a29935/app/dao/broadcast_service_dao.py (L69)
2022-03-24 12:26:06 +00:00
Ben Thorner
d1d3a6a6c3 Merge pull request #4182 from alphagov/refactor-email-branding-181415991
First set of refactorings for branding
2022-03-22 13:43:10 +00:00
Ben Thorner
6e81d05504 Rename test values to clarify they're branding IDs
In response to: [^1]

[^1]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r832009706
2022-03-22 13:02:39 +00:00
Chris Hill-Scott
a6e4f3441f Merge pull request #4191 from alphagov/remove-sizewell
Remove Sizewell from the demo areas library
2022-03-21 14:12:50 +00:00
Pea Tyczynska
eb0851e1e3 Please the navigation thing 2022-03-18 13:08:09 +00:00
Ben Thorner
99eebddfaf Bump -utils to get latest version of Shapely
This was pinned in [^1] but I'm not sure why - we ought to pin it
in -utils if it needs pinning. Version 1.7.1 doesn't work with Mac
M1 installs of Homebrew - unless you manually hack the library.

As per [^2], we don't think the calculation change matters much.

[^1]: 969e7a6dbd (diff-eee0e41c3756911002e040cf5a8f66b004bb66c8ff1a359bb8ba35d86081e80cR21)
[^2]: 8a10d74fc5
2022-03-15 15:34:11 +00:00
Chris Hill-Scott
0fa3e009c9 Remove Sizewell from the demo areas library
We added this for the 25 May demo. We’re unlikely to need it again.

We’re also unlikely to need this library again, so this commit removes
the source and the code that creates it.
2022-03-15 14:40:42 +00:00
Ben Thorner
e7aeb72fd9 Finish extracting UI tests for set branding
In response to: [^1].

The behaviour of the letter branding page is unchanged with set
branding, so we don't need an extra (and previously, broken [^2])
test for it. The email branding page shows a preview of existing
branding if it's set, so it's worth keeping that part of the test.

[^1]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825998534
[^2]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825999860
2022-03-15 12:18:27 +00:00
Ben Thorner
acd69b8d7d Combine tests for central org email branding
Central orgs have more options than others, including the option
to revert back to GOV.UK once branding is set. Combining the tests
together should make that a bit clearer.
2022-03-15 12:10:13 +00:00
Ben Thorner
fa3e6435a6 Fix small issues identified in PR review
In response to: [^1], [^2], [^3], [^4], [^5] and [^6].

[^1]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825824485
[^2]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825824805
[^3]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825857745
[^4]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825859850
[^5]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r825859982
[^6]: https://github.com/alphagov/notifications-admin/pull/4182#discussion_r826001823
2022-03-15 11:47:21 +00:00
Ben Thorner
857b8b04b0 Duplicate tests for options with branding set
This is a step towards further refactoring of the page tests, which
don't need to check in this level of detail anymore.
2022-03-15 11:47:20 +00:00
Ben Thorner
5a39e310aa Migrate two more tests to the branding utility
All of the mock / UI assertions in these tests are covered by the
tests above them - these tests were mostly targetting which options
were being shown, which we can check at a lower level.
2022-03-15 11:47:19 +00:00
Ben Thorner
1946d3c928 Migrate two branding tests to utils module
This is much simpler than trying to test the function via the page,
although there are still two scenarios to test there:

- The page with radio buttons (using NHS as an example).
- The page with a text form (using "other" as an example).

In future work we could split this test in two to make it clearer
what it's trying to test. For now, this keeps the diff simple.
2022-03-15 11:47:18 +00:00
Ben Thorner
a2d471eff4 Add missing assertion for letter button text
This is the same as the test below, which we will be removing soon.
2022-03-15 11:47:17 +00:00
Ben Thorner
bdcdfa6d0f Standardise branding tests to start with endpoint
This makes it easier to find all the tests that are relevant and
is consistent with how we name tests elsewhere in the app.
2022-03-15 11:47:13 +00:00
Chris Hill-Scott
9a1a328aca Format auth_type in a consistent way in the UI
On the ‘find user’ page it says ‘sms_auth’ instead of ‘Text message
code’.

This commit fixes that, and adds a handy formatter so it’s easier to do
the right thing in the future.
2022-03-14 14:55:31 +00:00
Ben Thorner
34c2c3b47c Merge pull request #4176 from alphagov/replay-falsey-values
Replay falsey values in input fields
2022-03-14 09:53:02 +00:00
Ben Thorner
6ba84140e5 Add test for rendering integer 0 in form input 2022-03-11 11:18:21 +00:00
Ben Thorner
e0b62bed70 Group form tests in a directory
This makes it clearer we have tests for the code in forms.py, which
I missed initially. In future we could also split up forms.py in a
similar way, as it's currently _very long_.

As part of grouping tests for code in forms.py, I've extracted some
from test_validators.py, so that what remains is focussed on testing
the code in validators.py.
2022-03-11 11:17:43 +00:00
Rebecca Law
de46fb6477 Merge pull request #4183 from alphagov/volume_reports
Report for total notifications sent per day for each channel.
2022-03-09 15:15:03 +00:00
Rebecca Law
c6e67d1690 Fix column names
Add unit test
2022-03-09 15:02:52 +00:00
Chris Hill-Scott
50015c3125 Pass admin URL to API for registration email
This follows the pattern for invite emails where the admin app tells the
API which domain to use when generating the link.
2022-03-07 15:11:50 +00:00
Rebecca Law
971cb745c9 Report for total notifications sent per day for each channel.
Daily volumes report: total volumes across the platform aggregated by whole business day (bst_date)
Volumes by service report: total volumes per service aggregated by the date range given.

NB: start and end dates are inclusive
2022-03-07 14:30:11 +00:00
Ben Thorner
3f2b760efb Remove redundant deletion decorators
These are superseded by the "_delete_template_cache_for_service"
call in each of these methods.
2022-03-07 13:54:00 +00:00
Ben Thorner
81d9c73543 Bump -utils to 55.0.0
This renames "delete_cache_keys_by_pattern" to match the new method
name, which will also catch exceptions if Redis is down [1].

Note that this also includes a change to RecipientCSV [2], which has
no effect because the new default is the same as the old behaviour.

[1]: https://github.com/alphagov/notifications-utils/pull/949
[2]: https://github.com/alphagov/notifications-utils/pull/947/files#diff-a8a994bf655634f89dc7439880708b4ff0d780ac1bd8033827d8aaa2692a8e0fR373
2022-03-07 13:53:57 +00:00
Ben Thorner
f827a825a1 Merge pull request #4180 from alphagov/dedup-something-else-181415991
Link directly to email branding "something else"
2022-03-07 11:33:11 +00:00
Ben Thorner
c22d3412fa Remove redundant fixtures and test setup
In response to [^1] and [^2].

[^1]: https://github.com/alphagov/notifications-admin/pull/4180/files#r819673624
[^2]: https://github.com/alphagov/notifications-admin/pull/4180/files#r819673799
2022-03-07 10:22:52 +00:00
Leo Hemsted
a7e6d5b442 Merge pull request #4177 from alphagov/41p-on-home-page
Update price of letters on home page
2022-03-03 17:15:10 +00:00
Pea Tyczynska
ae4fc977c1 Apply suggestions from code review
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2022-03-03 17:02:26 +00:00
Pea Tyczynska
8112930e24 Do not verify sms for pending users with email auth
This is to fix a bug where a user creates an account but doesn't
complete registration, then they are invited to a service that
changes their auth to email_auth, and then when they try to
complete registration they are still asked for sms code.

It should save users some pain, and reduce number of support tickets.
2022-03-03 17:02:26 +00:00
Chris Hill-Scott
fb3f79d83c Update pricing of letters on settings page
Follows https://github.com/alphagov/notifications-admin/pull/4174/files
2022-03-03 16:41:06 +00:00
Pea Tyczynska
08f0393553 Allow platform admins to change user auth in the UI
So we do not have to go into the db when we need to change user
auth.

We do not allow this for users who use webauthn. We do not want to
enable security downgrade for those users.
2022-03-03 13:44:13 +00:00
Ben Thorner
33c6ca0989 Link directly to email branding "something else"
Previously we duplicated the "something else" email branding form
on its own page and embedded in the choices form (if it was the
only option). See [^1] for how this looks - it's inconsistent.

This DRYs-up the "something else" form by bypassing the choices
form when "something else" is the only option. I've also tweaked
the "Back" button to be consistent with this behaviour.

Making this change also simplifies the choices form, which we'll
be adding pool options to shortly. I'd like to make the letters
form consistent, but let's see how emails pan out first.

Note that the choices form will now show a single radio button if
"something else" is the only option. I think that's OK as nothing
will link to the page, and the form still works.

[^1]: https://github.com/alphagov/notifications-admin/pull/4163#issuecomment-1050088088
2022-03-03 10:18:58 +00:00