Commit Graph

12486 Commits

Author SHA1 Message Date
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
332c240b01 Use "get_email_choices" directly in branding view 2022-03-30 17:46:44 +01:00
Ben Thorner
b4b1c91fb9 Remove redundant "something else" branding check
This is always allowed and there was no test for it.
2022-03-30 17:46:43 +01:00
Ben Thorner
8a7eed9b26 Minor refactorings to help read branding rules
I did consider having a "has_govuk_branding" variable, but I think
it's better to reinforce what this means with comments.
2022-03-30 17:46:42 +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
21eea0189d DRY-up listing NHS organisation types
The model should be the source of truth for this.
2022-03-30 17:46:40 +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
Ben Thorner
f022836f4d Move letter-specific logic down to its form class
For letters we still have the conditional reveal on the radio form
for the "something else" option.
2022-03-30 17:46:38 +01:00
Ben Thorner
352cdb80fa Remove remaining uses of ChooseBrandingForm
This was missed in a previous commit.
2022-03-30 17:46:37 +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
3164134260 Merge pull request #4197 from alphagov/show-api-keys-broadcast-179120842
Make it easy to see API keys for broadcast service
2022-03-25 09:48:51 +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
Tom Byers
23ca2dcabc Merge pull request #4193 from alphagov/fix-nav-link-focus-hover-bug
Strip underline from focused + hovered nav links
2022-03-24 11:27:48 +00:00
Pea Tyczynska
99682db7bf Change conditional for consistency 2022-03-22 17:55:55 +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
karlchillmaid
2031d41df7 Update prices and date 2022-03-22 12:22:54 +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
Tom Byers
848ee72e3f Strip underline from focused + hovered nav links
Our CSS for links in the navigation, which makes
the underline appear on hover is overriding the
GOVUK focus styles, making it look like there are
2 underlines. This adds some extra CSS to reset
it.

The new CSS is further down the stylesheet to the
hover styles. This gives them a higher specificity
meaning they override them when these links are
hovered over while in focus.
2022-03-17 16:11:56 +00:00
Ben Thorner
3033c29c93 Merge pull request #4192 from alphagov/bump-shapely-mac-m1-181498273
Bump -utils to get latest version of Shapely
2022-03-15 15:50:44 +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
6a2367bb72 Merge pull request #4184 from alphagov/simplify-session-clear
Simplify "activate_user" to clear session earlier
2022-03-15 13:07:53 +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
f02c2b0b1d Rename other "Admin" forms consistently
I've also tweaked some of the names to make them clearer e.g. that
the form is used to apply a change to a service.

I've constrained the scope of this change to avoid forms that may
be accessible by non-admins in the future.
2022-03-15 11:47:22 +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
2fc0a105f4 Move branding choices logic into utility module
This was a lot of code to be in a form and it's going to get even
more complicated with email branding pools. Moving it out means we
can also simplify the tests that target this code.
2022-03-15 11:47:16 +00:00
Ben Thorner
a04ed3eca5 Use separate classes for branding option forms
These are about to become a lot less similar to each other when we
add email branding pools. Note that the optional *args and *kwargs
weren't used anywhere.
2022-03-15 11:47:15 +00:00
Ben Thorner
26d1222f1c Rename branding forms to clarify who they're for
I've often struggled to find the form associated with a particular
page due to the overlapping names e.g. "SetEmailBranding" sounds
more like the radio button form a user sees than "BrandingOptions".

Almost every form in forms.py also ends with "Form", so this also
makes the branding forms consistent with that naming convention.
2022-03-15 11:47:14 +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
4903e9d60e Merge pull request #4190 from alphagov/format-auth-type
Format `auth_type` in a consistent way in the UI
2022-03-15 10:48:12 +00:00
Chris Hill-Scott
ff46f9beb8 Remove default from format_auth_type
I think it’s better to raise an exception and force us to fix it if we ever add a new auth_type, or use this formatter on something that isn’t a valid auth_type.

Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2022-03-15 10:40:10 +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
Tom Byers
2a565e363a Merge pull request #4171 from alphagov/fix-alert-text-click
Remove grid from alerts file-list
2022-03-11 15:09:51 +00:00