Commit Graph

12486 Commits

Author SHA1 Message Date
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
efea27d433 Don't show priority for inactive providers
This is consistent with not being able to set it either. I think
it's OK to not have a test for this as it's purely cosmetic.
2022-04-07 14:05:07 +01:00
Ben Thorner
0437e4a248 Standardise appearance of missing data
This makes the rendering the same as for "created_by_name" when the
data isn't present. It's a bit more complicated for "updated_at" so
I checked that it's implicitly covered by the tests, which fail if I
remove the "if" conditional for any of these fields.
2022-04-07 14:05:06 +01:00
Ben Thorner
7f52e8dedf Add missing test for editing inactive providers 2022-04-07 14:05:05 +01:00
Ben Thorner
264bf8302f Remove redundant sorting when editing SMS ratios
This is irrelevant since we no longer pick a "first" provider.
2022-04-07 14:05:04 +01:00
Ben Thorner
dd0022968c Remove redundant constraint on multiple providers
We can now handle a single provider (with a priority of 100%).  I
don't think we need to handle the case of no providers.
2022-04-07 14:05:03 +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
25a26c0b4d Add caveat about provider version history
To go with https://github.com/alphagov/notifications-api/pull/3500
2022-04-07 13:43: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
770e8bd0a3 Merge pull request #4204 from alphagov/bump-deps
Unpin the prometheus-client and use the latest version
2022-04-06 16:13:18 +01:00
Katie Smith
31e287d039 Unpin prometheus-client and use the latest version
The prometheus-client was pinned to avoid installing version 0.10.0,
which removed support for `prometheus_multiproc_dir` and renamed the
variable `PROMETHEUS_MULTIPROC_DIR`. Version 0.10.1 reintroduced support
for the lowercase `prometheus_multiproc_dir` environment variable.
2022-04-06 14:57:56 +01:00
Katie Smith
b6b8b74035 Bump pyexcel-ods3 to 0.6.1 2022-04-06 13:42:20 +01:00
Katie Smith
09c4661016 Merge pull request #4203 from alphagov/bump-dependencies
Remove importlib_metadata as a dependency and bump dependencies that look relatively safe
2022-04-06 13:23:51 +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
Katie Smith
0bec5e8f0a Update pyproj from 3.2.1 to 3.3.0 2022-04-06 12:17:09 +01:00
Katie Smith
f3db221fcb Bump notifications-utils to 55.1.2
This brings in a change to allow pyproj to be updated.
2022-04-06 12:06:36 +01:00
Katie Smith
777f719185 Update pyexcel from 0.6.7 to 0.7.0 2022-04-06 10:30:53 +01:00
Katie Smith
0feb37743a Update pytz from 2021.3 to 2022.1 2022-04-06 09:37:27 +01:00
Katie Smith
7e5e4b18a0 Update flask-login from 0.5.0 to 0.6.0 2022-04-06 09:29:37 +01:00
Katie Smith
57f8a724c1 Update flask-wtf from 1.0.0 to 1.0.1 2022-04-06 09:25:32 +01:00
Katie Smith
8d3eedd88e Remove importlib-metadata from requirements file
This was pinned in
ee3fb2f175
to prevent version conflicts. It only seems to be required by packages
when the version of Python is 3.8 or lower
(e.g. 21d3c70d67/docs/source/release-notes/3.8.0.rst (new-dependency-information)),
so is now not required anyway.
2022-04-06 08:54:57 +01:00
Ben Thorner
a72aa4f853 Merge pull request #4199 from alphagov/provider-fixes-181574489
Support changing priorities with inactive SMS provider
2022-04-05 16:17:44 +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
59f6b0b5d8 Replace "primary", etc. with "first", etc.
Using "primary" made sense when the other "secondary" provider was
new, but today we see them as equivalent and the terminology is a
bit confusing. In future we may add a third provider as well.
2022-04-05 15:55:06 +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
Richard Baker
a1c6b24749 Merge pull request #4202 from alphagov/node_16
Add package-lock.json & update to Node 16 LTS
2022-04-05 15:54:24 +01:00
Richard Baker
799949a3f4 Add .nvmrc & use NVM to manage installed Node version
We have decided to use NVM to manage installed Node versions locally
and in CI to ensure they match and produce consistent builds.

Running `nvm install` will install the Node version specified in the
`.nvmrc` file.

This is now consistent with Document Download Frontend.
See: alphagov/document-download-frontend#114

Signed-off-by: Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
2022-04-05 12:09:53 +01:00
Richard Baker
5fa324a680 Add package-lock.json file using Node 16 LTS & NPM 8
Creates a "v2" package-lock.json file for consistent dependency
installation.

Lock file created using `npm i --package-lock-only`

Signed-off-by: Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
2022-04-05 11:36:33 +01:00
David McDonald
9a2f6f27df Merge pull request #4195 from alphagov/pricing-page-update-1-april-22
Update text message allowances and cost
2022-04-01 10:02:50 +01:00
karlchillmaid
7c208c48b4 Update text message allowance and cost 2022-04-01 09:14:24 +01:00
karlchillmaid
7ec5c7262a Update text message cost 2022-04-01 09:11:56 +01:00
Ben Thorner
2b8a2f3a81 Merge pull request #4196 from alphagov/branding-refactorings-2-181415991
Final set of refactorings for email branding
2022-03-31 09:58:19 +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
6030e9e5bb Decouple the set of org types from their labels
In response to: [^1].

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