Commit Graph

4294 Commits

Author SHA1 Message Date
Katie Smith
b5fa270cd2 Bump all test dependencies
This results in some new errors from flake8-bugbear:
```
B020: Loop control variable overrides iterable it iterates
```
I can't see an issue with the places that we do this, so have ignored
these warnings. If we keep getting these and they look fine, we can
create a global rule to ignore B020.
2022-04-06 12:17:09 +01:00
Ben Thorner
e02dbde378 Small changes to address PR comments
In response to [^1] and [^2].

[^1]: https://github.com/alphagov/notifications-admin/pull/4199#discussion_r842653983
[^2]: https://github.com/alphagov/notifications-admin/pull/4199#discussion_r842667340
2022-04-05 15:55:07 +01:00
Ben Thorner
55e2a2f96b Stop reversing the order of SMS providers
This makes no functional difference but does make it easier to read.
2022-04-05 15:55:05 +01:00
Ben Thorner
9355c4f8d1 Only show active providers when changing priority
This fixes a bug where a third inactive provider would (potentially)
appear in place of one of the two active ones, depending on the order
of its identifier compared to the other two.

In future we may look at simplifying this to cope with more than two
active providers. For now, the existing UI will continue to work when
we add a new, inactive SMS provider for Reach.
2022-04-05 15:55:04 +01:00
Ben Thorner
f9749c0ae3 Standardise priorities / names for test providers
Only multiples of 10 are possible in practice. This will make it
easier to use this test data in the next commits.
2022-04-05 15:55:03 +01:00
Ben Thorner
0f9b73f73c Use fixtures instead deep-copying constants
This is more conventional and removes the ambiguity about whether
the deepcopy was actually necessary for new tests.
2022-04-05 15:55:02 +01:00
Ben Thorner
396e9e3743 Split up provider test data into separate vars
This makes it easier to follow which dict is being referred to as
the indices didn't convey this.
2022-04-05 15:55:01 +01:00
Ben Thorner
7a7d8f8aa6 Link to history for SMS providers
Although the priority history is shown on the "Change priority"
page, this doesn't show active/inactive changes.
2022-04-05 15:54:58 +01:00
Ben Thorner
c7951f8667 Split out email and letter branding request tests
In response to: [^1].

I've named the file to distinguish it from the admin endpoints to
set branding.

[^1]: https://github.com/alphagov/notifications-admin/pull/4196#discussion_r838734482
2022-03-30 17:46:55 +01:00
Ben Thorner
a27b5eb12b Move service setting tests into subdirectory
In response to: [^1].

This makes it clearer that the tests are split between files.

[^1]: https://github.com/alphagov/notifications-admin/pull/4196#discussion_r838734482
2022-03-30 17:46:54 +01:00
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