Commit Graph

12190 Commits

Author SHA1 Message Date
Chris Hill-Scott
0706664be4 Stop using logged_in_client fixture
We have a `client_request` fixture which does a bunch of useful stuff
like:
- checking the status code of the response
- returning a `BeautifulSoup` object

Lots of our tests still use an older fixture called `logged_in_client`.
This is not as good because:
- it returns a raw `Response` object
- doesn’t do the additional checks
- means our tests contain a lot of repetetive boilerplate like `page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')`

This commit converts all the tests using `logged_in_client` to:
use `client_request` instead.
2022-01-10 14:39:44 +00:00
Chris Hill-Scott
50eae6f935 Stop using platform_admin_client fixture
We have a `client_request` fixture which does a bunch of useful stuff
like:
- checking the status code of the response
- returning a `BeautifulSoup` object

For most tests of a platform admin view we used `platform_admin_client`
instead. This is not as good because it returns a raw `Response` object
and doesn’t do the additional checks.

This commit converts all the tests using `platform_admin_client` to:
use new `client_request` and log in as `platform_admin_user` before
making any requests.

This is also nice because it makes any test easy to parametrize with
additional users, for example to test differences in behaviour dependant
on being platform admin or not.
2022-01-10 14:39:40 +00:00
Chris Hill-Scott
0fd79bb500 Merge pull request #4122 from alphagov/no-text-in-svg
Don’t allow <text> elements in letter logos
2022-01-10 11:13:09 +00:00
Chris Hill-Scott
a6ae1aa218 Merge pull request #4124 from alphagov/format-inbound-sms-download
Format phone numbers with spaces in download of received text messages
2022-01-10 11:12:27 +00:00
Ben Thorner
a0b486d1e5 Merge pull request #4116 from alphagov/revert-sentry-180766893
Revert "Trial running Sentry in Admin"
2022-01-10 10:15:00 +00:00
Chris Hill-Scott
75f8c16071 Convert test to use client_request fixture
This is to avoid merge conflicts with
https://github.com/alphagov/notifications-admin/pull/4118/files
2022-01-06 17:39:01 +00:00
Chris Hill-Scott
291906e9fd Don’t allow <text> elements in letter logos
To render text in an SVG consistently the system rendering the SVG must
have the fonts specified by the SVG installed.

If the fonts are not installed then the renderer will fall back to a
system font and the text will look different. This is especially bad
news for branding where the right font is an integral part of any brand.

To fix this, the text should instead be converted to `<path>` elements.
This process is sometimes called ‘outlining’.

A few of our logos had this problem, and I’ve fixed most of them by
hand. Adding this validation will stop the problem, coming up again.
2022-01-06 17:39:01 +00:00
Chris Hill-Scott
5558af2527 Refactor for reuse 2022-01-06 17:39:01 +00:00
karlchillmaid
1287526369 Merge pull request #4123 from alphagov/add-review-date-content
Add next review date
2022-01-06 16:45:38 +00:00
Chris Hill-Scott
474d7dfda8 Format phone numbers with spaces in download of received text messages
Some users have reported a problem with the received text message
report:

> I have tested the reply service but in the excel report the mobile
> number is showing as 4.47900E+23. How can I change the format so that
> it is show the mobile number that has replied?

This is happening because Excel is interpreting a phone number in the
format `447900900123` as a number in
[scientific notation](https://en.wikipedia.org/wiki/Scientific_notation),
in other words 4.479 &times; 10<sup>23</sup>.

`447900900123` is the format that our provider is giving us the number
in – there’s no guarantee it will always be in this format.

We can prevent this behaviour by putting spaces in the numbers. Excel
and Google Sheets won’t try to convert a string with spaces into a
number.

I think we used to do this for the sent text messages report but
probably stopped because we decided it was better to keep the phone
number in the same format as it had been supplied to us for
reconcilliation purposes.
2022-01-06 16:41:41 +00:00
karlchillmaid
bd313e5e2a Add next review date 2022-01-06 15:41:36 +00:00
karlchillmaid
c08948ca3f Add next review date 2022-01-06 15:40:14 +00:00
karlchillmaid
da16ab14c3 Merge pull request #4115 from alphagov/make-page-update-dates-consistent
Make ‘last updated’ section consistent
2022-01-05 18:06:40 +00:00
Tom Byers
0fe03993cd Add content-metadata component to other pages 2022-01-05 15:22:59 +00:00
Tom Byers
4f10272b00 Add styles and Jinja for component
Most of these are cut-and-paste'd from the GOVUK
metadata component:

https://components.publishing.service.gov.uk/component-guide/metadata

...but stripped back to only include what we need
and a optional suffix paragraph added.

Links to styles and ERB template
https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss
https://github.com/alphagov/govuk_publishing_components/blob/master/app/views/govuk_publishing_components/components/_metadata.html.erb

Also adds it to the accessibility statement as an
example and updates the test that checks any
updates bump the date.
2022-01-05 15:21:37 +00:00
karlchillmaid
342fd35136 Remove dates from end of statement 2022-01-05 15:20:23 +00:00
karlchillmaid
483fcf1a3a Update content to fit new component 2022-01-05 15:20:22 +00:00
karlchillmaid
41fef84f8a Update content to fit new component 2022-01-05 15:20:21 +00:00
karlchillmaid
00355c405b Update content to fit new component 2022-01-05 15:20:20 +00:00
karlchillmaid
ed8efb6a37 Make wording consistent 2022-01-05 15:20:19 +00:00
karlchillmaid
a222891f19 Update ‘updated’ content 2022-01-05 15:20:18 +00:00
karlchillmaid
bb98078315 Update ‘updated’ content 2022-01-05 15:20:17 +00:00
karlchillmaid
ca11d87a57 Add ‘last updated’ section 2022-01-05 15:20:16 +00:00
Ben Thorner
3c3bc71cc0 Revert "Trial running Sentry in Admin"
This reverts commit 5ae8acb8aa.
2022-01-05 14:35:49 +00:00
Ben Thorner
7834f709f9 Merge pull request #4121 from alphagov/more-sentry-tweaks-180766893
Tweak Sentry config to work in development
2022-01-05 12:37:12 +00:00
Katie Smith
d35e691e04 Merge pull request #4105 from alphagov/post-on-search
Update `get_notifications_for_service` to make POST requests
2022-01-04 15:12:24 +00:00
Ben Thorner
7f0ab3d1db Tweak Sentry config to work in development
This makes a couple of changes:

- Most importantly, it wraps the setup code in a conditional so that
developers don't need to have a DSN set to start the app locally.

- Secondly, it removes the redundant call to "set_level". Originally
I thought the integration was sending info/warning events, but this
isn't the case [1] and even if it was, "set_level" affects the level
of custom events [2], not the level they are dispatched at.

[1]: 4c09f3203d/sentry_sdk/integrations/logging.py (L56)
[2]: https://docs.sentry.io/platforms/python/guides/logging/usage/set-level/
2022-01-04 11:53:26 +00:00
David McDonald
04fa99b3dc Update get_notifications_for_service to make POST requests
This updates the `get_notifications_for_service` of the
`NotificationApiClient` to make POST request to the api when the `to`
field is provided. This is done so that we avoid logging personal
details such as email addreses.

If the `to` field is not present, the method will make a GET reqeust and
there will be no change to how it works.
2022-01-04 11:14:16 +00:00
Ben Thorner
444d844dfb Merge pull request #4119 from alphagov/sentry-redis-180766893
Add RedisIntegration to Sentry trial
2022-01-04 11:00:26 +00:00
Ben Thorner
1bc174d357 Add RedisIntegration to Sentry trial
This should expose additional performance stats.
2021-12-31 17:43:10 +00:00
Ben Thorner
01d3c10857 Merge pull request #4117 from alphagov/silence-python-client-180766893
Silence errors from Python Client
2021-12-31 13:08:38 +00:00
Ben Thorner
d752b0b83a Silence errors from Python Client
Otherwise we start spamming Sentry with every 404 error log. Even
if the erorr is a 5xx, it depends on how we handle it in the calling
code as to whether we would want to consider it an error.

I didn't spot this in initial testing on Preview because the 404s in
Preview are only triggered due to the functional tests, which only run
when we're deploying something.

Arguably we shouldn't be logging at error level in our Python Client,
since we're also raising an exception [1]. But changing that would be
a can of worms as it's not an internal-only library.

[1]: 74a958de00/notifications_python_client/base.py (L118)
2021-12-31 12:04:35 +00:00
Ben Thorner
5818c9b4a3 Merge pull request #4114 from alphagov/trial-sentry-180766893
Trial running Sentry in a Flask app
2021-12-31 11:31:53 +00:00
Ben Thorner
5ae8acb8aa Trial running Sentry in Admin
This will capture and send various events to Sentry:

- Any unhandled exceptions.
- Any logger.error calls.
- Some request traces.

The latter are severely limited to avoid going over the free tier
limits for Sentry, and to avoid excess effort on our end.
2021-12-31 10:57:05 +00:00
Chris Hill-Scott
93bb29a219 Merge pull request #4108 from alphagov/hide-org-report-download-no-services
Hide ‘Download this report’ link when no services
2021-12-30 14:17:59 +00:00
Chris Hill-Scott
2f0e3f39d3 Hide ‘Download this report’ link when no services
If an organisation doesn’t have any live services then there’s no data
to download. To make things less confusing we should hide the link in
this case.

This commit also modifies the existing test so that the assertions are
consistent.
2021-12-30 14:09:42 +00:00
Chris Hill-Scott
a3f940d9f4 Merge pull request #4109 from alphagov/lxml-4.6.5
Force lxml to latest version
2021-12-30 14:09:27 +00:00
Chris Hill-Scott
6464ffb8ed Force lxml to latest version
Lower versions have a security vulnerability, see
https://github.com/lxml/lxml/security/advisories/GHSA-55x5-fj6c-h6m8

The `pyexcel-*` packages which require `lxml` don’t pin a version.

`pip-compile` will respect what’s in `requirements.txt` as long as the
dependencies are fulfilled[1] so we don’t need to add it to
`requirements.in`

---

1. https://github.com/jazzband/pip-tools#updating-requirements
2021-12-30 12:40:32 +00:00
Ben Thorner
c4f64e9480 Merge pull request #4113 from alphagov/bump-govuk-bank-hols
Bump govuk-bank-holidays to latest version
2021-12-30 12:08:36 +00:00
Ben Thorner
69fbce50ed Bump govuk-bank-holidays to latest version
While the package can always fetch new holidays via the GOV.UK API,
the latest version of the packages also caches ones for next year,
which means we can avoid unnecessary web requests.
2021-12-30 09:29:18 +00:00
Ben Thorner
e74ef68b5c Merge pull request #4112 from alphagov/standard-freeze-180760212
Centralise documentation for updating dependencies
2021-12-29 16:01:04 +00:00
Ben Thorner
f87fca9aa0 Centralise documentation for updating dependencies
This follows the convention established in [1].

[1]: https://github.com/alphagov/notifications-antivirus/pull/83
2021-12-29 15:01:21 +00:00
Leo Hemsted
817d485860 Merge pull request #4111 from alphagov/leohemsted-patch-2
remove rogue bullet point
2021-12-29 14:05:03 +00:00
Leo Hemsted
295cd9bf8b remove rogue bullet point 2021-12-29 12:52:27 +00:00
Pea Tyczynska
65241b11df Merge pull request #4106 from alphagov/revert-4080-remove-sms-allowance-remainder-org-report
Revert "Remove free text allowance remaining column from organisation report"
2021-12-29 10:16:16 +00:00
Pea Tyczynska
e8876a0632 Make mocks more realistic
SMS remainder is never None, in practice it would be either 0 or
a natural number.
2021-12-22 17:31:01 +00:00
Pea Tyczynska
58fe9d5b56 Revert "Remove free text allowance remaining column from organisation report" 2021-12-21 16:05:29 +00:00
Katie Smith
e97db6e80a Merge pull request #4103 from alphagov/add-gov-domain
Add hscni.net to list of allowed domains
2021-12-20 11:51:36 +00:00
Katie Smith
812aa3ffe8 Add hscni.net to list of allowed domains
We can't assign `hscni.net` to an organisation because it is used
by GP surgeries, so we don't always know which org it should be
associated with. This change allows people with the an `hscni.net`
email address to sign up and create a service.
2021-12-20 11:41:10 +00:00
karlchillmaid
56889a4ada Merge pull request #4082 from alphagov/clarify-free-text-message-allowance
Update text message pricing description
2021-12-17 11:46:07 +00:00