Commit Graph

4314 Commits

Author SHA1 Message Date
Leo Hemsted
19d501e2aa Merge pull request #4214 from alphagov/0-free-allowance
Hide remaining free allowance if it starts at 0
2022-04-22 13:32:16 +01:00
Ben Thorner
4a3ba97115 Remove redundant conditional for CF Redis
This is now used in all environments and we've removed support for
non-CF Redis [1].

[1]: https://github.com/alphagov/notifications-admin/pull/4213
2022-04-20 11:32:57 +01:00
Chris Hill-Scott
d11beee5b6 Hide remaining free allowance if it starts at 0
If your free allowance starts a 0 (which we have done for some services
this year) it’s redundant to say ‘0 of 0 remaining’.
2022-04-20 10:53:05 +01:00
Ben Thorner
be1fc9de79 Remove redundant CloudFoundry config code
These env vars can be set directly in the manifest, like we do for
Template Preview [^1].

[^1]: c08036189b/manifest.yml.j2 (L23-L26)
2022-04-13 14:45:29 +01:00
Ben Thorner
339ca93d9b Add support for migrating to Redis on PaaS
Similarly to https://github.com/alphagov/notifications-api/pull/3508
2022-04-12 17:46:45 +01:00
Leo Hemsted
1bed87b67d Merge pull request #4206 from alphagov/daily-sms-vols-reports
add new daily sms provider volumes report
2022-04-12 15:48:36 +01:00
Leo Hemsted
971101d07c clean up test_platform_admin string concatenation
make it consistent - always use a + to concatenate strings, always have
that + at the end of the line.

(also remove a rogue "when" from some test names)
2022-04-11 14:55:58 +01:00
Leo Hemsted
ebc005005b refactor: DRY up billing api client test
at the same time add the new daily_sms_provider_volumes_report func to
the tests.
2022-04-11 14:40:32 +01:00
Leo Hemsted
b3f5bb6435 add new daily sms provider volumes report
nearly identical to the daily-volumes-report but sms only, and split up
by provider
2022-04-11 14:40:31 +01:00
Ben Thorner
9132004ea3 DRY-up creating provider fixtures 2022-04-07 14:05:10 +01:00
Ben Thorner
05c396434d Use fixtures for SMS provider test data
This avoids the need to manually copy psuedo fixture data to avoid
breaking other tests.
2022-04-07 14:05:09 +01:00
Ben Thorner
6d77ff54b1 Standardise provider psuedo fixture data
Previously it was hard to distinguish ids from identifiers from
display names (in the case of the email fixtures).

Using predictable attributes will also make it easier to convert
this dictionaries to proper fixtures.
2022-04-07 14:05:08 +01:00
Ben Thorner
7f52e8dedf Add missing test for editing inactive providers 2022-04-07 14:05:05 +01:00
Ben Thorner
c4e1f40b43 Add missing test for viewing SMS ratio edit page 2022-04-07 14:05:02 +01:00
Ben Thorner
55e89b3f12 Add validation for provider SMS percentages
We could alternatively put the "add up to 100%" error on the page
using form-level errors [^1] and a custom flash message. Putting
the error on each field is slightly simpler and does make it clear
the issue is with all of the fields together.

[^1]: 22636b55ed
2022-04-07 14:05:01 +01:00
Ben Thorner
7f333ba5fe Rewrite SMS ratio form to cope with 3 providers
This replaces the slider with an integer input for each provider.
Unfortunately showing a variable number of inputs isn't easy to
achieve in WTForms [^1], but we think this is the least worst way
to do it vs e.g. not using WTForms at all.

[^1]: https://github.com/wtforms/wtforms/issues/736
2022-04-07 14:05:00 +01:00
Ben Thorner
01389b5edf Rename provider tests to match endpoint under test
This makes it clearer which tests we have for what.
2022-04-07 14:04:59 +01:00
Ben Thorner
8655ab7dea Stop showing priorities for other provider types
This isn't used and showing priorities when we only have a single
provider or where they have no effect is unnecessarily confusing.
Removing the form makes it clearer that there's only one way to
adjust priorities for domestic SMS providers.

If we add another email or international SMS provider in future,
we would need to rewrite the form here anyway as the priorities
need to be adjusted in tandem, not individually.
2022-04-07 14:04:57 +01:00
Ben Thorner
66335d20c2 Return to main provider page after editing ratio
Staying on the edit page is atypical behaviour for an edit form,
especially now it no longer shows the version history.
2022-04-07 13:43:56 +01:00
Ben Thorner
a3231effb1 Remove version history from provider ratio page
This doesn't work with 3 providers. You can still see the version
history for each provider on their dedicated page.
2022-04-07 13:43:54 +01:00
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