Commit Graph

8981 Commits

Author SHA1 Message Date
pyup-bot
4da0ef75a3 Update werkzeug from 2.0.3 to 2.1.2 2022-06-01 14:00:15 +01:00
pyup-bot
90965d23c7 Update s3transfer from 0.5.2 to 0.6.0 2022-06-01 14:00:15 +01:00
pyup-bot
563a080c0d Update rsa from 4.7.2 to 4.8 2022-06-01 14:00:15 +01:00
pyup-bot
8bd00dd608 Update pyyaml from 5.4.1 to 6.0 2022-06-01 14:00:14 +01:00
pyup-bot
457945e991 Update pypdf2 from 1.28.2 to 2.0.0 2022-06-01 14:00:14 +01:00
pyup-bot
0a1c6fa0fb Update phonenumbers from 8.12.48 to 8.12.49 2022-06-01 14:00:14 +01:00
pyup-bot
17d0ff0eb2 Update mistune from 0.8.4 to 2.0.2 2022-06-01 14:00:13 +01:00
pyup-bot
820a28e02f Pin gunicorn to latest version 20.1.0 2022-06-01 14:00:13 +01:00
pyup-bot
8401b29a65 Pin gds-metrics to latest version 0.2.4 2022-06-01 14:00:13 +01:00
pyup-bot
9446f3b668 Pin flask-sqlalchemy to latest version 2.5.1 2022-06-01 14:00:12 +01:00
pyup-bot
d716fc51a3 Update docutils from 0.16 to 0.18.1 2022-06-01 14:00:12 +01:00
pyup-bot
a80c49f2d5 Update botocore from 1.26.8 to 1.27.0 2022-06-01 14:00:11 +01:00
pyup-bot
f86ae8b481 Update boto3 from 1.23.8 to 1.24.0 2022-06-01 14:00:11 +01:00
pyup-bot
77bb091db2 Update bleach from 4.1.0 to 5.0.0 2022-06-01 14:00:10 +01:00
pyup-bot
bb16384d57 Update billiard from 3.6.4.0 to 4.0.0 2022-06-01 14:00:10 +01:00
pyup-bot
2ec0847748 Update awscli from 1.24.8 to 1.25.0 2022-06-01 14:00:10 +01:00
pyup-bot
e846147f04 Update alembic from 1.7.7 to 1.8.0 2022-06-01 14:00:09 +01:00
pyup-bot
93a7121b54 Update moto from 3.1.9 to 3.1.11 2022-06-01 14:00:09 +01:00
pyup-bot
72156b02da Update lxml from 4.8.0 to 4.9.0 2022-06-01 14:00:08 +01:00
pyup-bot
926a0d36e6 Update lxml from 4.8.0 to 4.9.0 2022-06-01 14:00:08 +01:00
pyup-bot
c0c7b612dc Update cachetools from 5.1.0 to 5.2.0 2022-06-01 14:00:07 +01:00
pyup-bot
059a8a0bb5 Update cachetools from 5.1.0 to 5.2.0 2022-06-01 14:00:07 +01:00
pyup-bot
e3a2458f17 Update sqlalchemy from 1.4.36 to 1.4.37 2022-06-01 14:00:06 +01:00
pyup-bot
e373fc42fa Update sqlalchemy from 1.4.36 to 1.4.37 2022-06-01 14:00:06 +01:00
pyup-bot
a8bc7364cf Update marshmallow from 3.15.0 to 3.16.0 2022-06-01 14:00:06 +01:00
pyup-bot
474f85fa9a Update marshmallow from 3.15.0 to 3.16.0 2022-06-01 14:00:05 +01:00
pyup-bot
bc241a3fcb Update celery from 5.2.6 to 5.2.7 2022-06-01 14:00:05 +01:00
pyup-bot
908f7b5490 Update celery from 5.2.6 to 5.2.7 2022-06-01 14:00:04 +01:00
Katie Smith
6495b192a6 Merge pull request #3550 from alphagov/rename-migration-file
Rename migration file
2022-05-27 15:25:05 +01:00
Katie Smith
4961c7cefc Rename migration file
This renames the latest migration file to match the Revision ID in the
file. When these names are different, our deployment pipeline tries to
run migrations on the notify-api-db-migration app and runs the
functional tests twice.
2022-05-27 14:58:01 +01:00
Katie Smith
67be0eed1e Merge pull request #3549 from alphagov/bump-dependencies
Upgrade marshmallow-sqlalchemy plus the unpinned dependencies
2022-05-27 14:19:27 +01:00
Katie Smith
d17be0354a Pin Werkzeug
We can't use version later than the one currently in requirements.in
because the version of flask-sqlalchemy that we are using won't work
with version 2.1.0 and above.
2022-05-27 09:57:10 +01:00
Katie Smith
8dd6d073d3 Run pip-compile --upgrade
This upgrades the sub-dependencies which we don’t pin in `requirements.txt`.
2022-05-27 09:57:10 +01:00
Katie Smith
4404f9eb12 Upgrade marshmallow-sqlalchemy from 0.23.1 to 0.28.0
This was blocked before due to being on marshmallow 2, but now that we
are on marshmallow 3 we can upgrade this package.
2022-05-26 14:18:51 +01:00
Ben Thorner
43dbc0891f Merge pull request #3546 from alphagov/notification-view-178125825
Use notification view for status / billing tasks
2022-05-26 11:03:38 +01:00
Ben Thorner
aa20064f3f Merge pull request #3545 from alphagov/remove-unused-function
Remove redundant DAO function / consolidate tests
2022-05-26 11:03:30 +01:00
Katie Smith
a6d25154d9 Merge pull request #3541 from alphagov/v3-marshmallow
Upgrade Marshmallow to version 3
2022-05-26 09:40:06 +01:00
Katie Smith
82862112fa Remove unused attributes on ServiceSchema
This removes the `override_flag` attribute, which we stopped using in #98cd838510979d467191685aac38ff2e287a92c5
2022-05-25 11:35:44 +01:00
Katie Smith
4ffdd32054 Keep the marshmallow v2 way of serializing DateTimes
Marshmallow v3 has changed the way that DateTimes get serialized
(https://marshmallow.readthedocs.io/en/stable/upgrading.html#datetime-leaves-timezone-information-untouched-during-serialization).

In order to avoid breaking anything, we want to keep the existing way of
handling DateTimes for now - this could be changed later. We can't just
pass a `format` argument to a DateTime field with the old format, which
looked like this `2017-09-19T00:00:00+00:00`. When we tried that,
Marshmallow then expected data that we are loading to also have that
format, which it doesn't.

This adds a new field, which serializes data in the old format but which
doesn't require data that is being deserialized to have such a precise
format.
2022-05-25 11:35:44 +01:00
Katie Smith
053397d8d4 Add deserialize method for ServiceSchema permissions field
Due to a difference in marshmallow 3, when calling
`service_schema.load()` with permissions data the permissions data was
being dropped. We could fix this by allowing the ServiceSchema to
include any unknown keys using but that have unexpected consequences.

Instead, this change adds a method so that the schema knows how to
deserialize permissions. This uses the same code that the `pre_load`
method uses, but there were errors when it wasn't included in both places.
2022-05-25 11:35:44 +01:00
Katie Smith
8e7f2615a9 Fix test assertion
This test was calling `.load` on model objects, when it should have
been calling `.dump`. This was not working as expected before the
marshmallow upgrade either - the objects returned were errors and not
template versions.
2022-05-25 11:35:44 +01:00
Katie Smith
21c943484d Change test that was failing due to new Marshmallow behaviour
Boolean fields in marshmallow have various values that get changed to
True or False. The value 'Yes' now gets changed to True,  which was
causing a test to start failing. We could change the schemas to stop
'Yes' from being changed to True, but the data for boolean fields comes
from admin, where it is only allowed to have certain values anyway so
this just fixes the test.
2022-05-25 11:35:44 +01:00
Katie Smith
57788e5da1 Add new schema, TemplateSchemaNested
When we nest the `TemplateSchema` as a field on the
`NotificationWithTemplateSchema`, we want to include the
`is_precompiled_letter` field. However, we don't want the
`is_precompiled_letter` in any of the other places that we use the
`TemplateSchema`.

The way we had the code was giving errors in version 3 of Marshmallow
since `is_precompiled_letter` was not defined on the `TemplateSchema`.
Instead of writing complicated logic around when the field should be
included or excluded, this adds a new schema which we can use in the one
place where we do want to include `is_precompiled_letter`.
2022-05-25 11:35:44 +01:00
Katie Smith
cfb6c9abc0 Make pre/post processors return modified data
https://marshmallow.readthedocs.io/en/stable/upgrading.html#pre-post-processors-must-return-modified-data

We had a few cases where the pre/post processors weren't returning
anything. They now need to return the modified data.
2022-05-25 11:35:44 +01:00
Katie Smith
ab2c33f1a3 Replace dump_to with data_key
https://marshmallow.readthedocs.io/en/stable/upgrading.html#load-from-and-dump-to-are-merged-into-data-key

No change to how things work here, just a kwarg that has been renamed.
2022-05-25 11:35:44 +01:00
Katie Smith
28e08b429d Keep behaviour of deserializing unknown keys
Keep the marshmallow 2 behaviour of dropping unknown keys
https://marshmallow.readthedocs.io/en/stable/upgrading.html#schemas-raise-validationerror-when-deserializing-data-with-unknown-keys

The new default is to raise an error for unknown keys.

This also adds the optional fields that the `EmailDataSchema` can
have to the schema - `next` and `admin_base_url`.
2022-05-25 11:35:44 +01:00
Katie Smith
fc9b3bea1d Make the post and pre decorators take kwargs
https://marshmallow.readthedocs.io/en/stable/upgrading.html#decorated-methods-and-handle-error-receive-many-and-partial
2022-05-25 11:35:44 +01:00
Katie Smith
8ae2b0bb31 Replace how .dump is called
As with `.load`, only data is now returned instead of a tuple.
2022-05-25 11:35:44 +01:00
Katie Smith
bd4f74b359 Replace how .load is called
https://marshmallow.readthedocs.io/en/stable/upgrading.html#schemas-are-always-strict

`.load` doesn't return a `(data, errors)` tuple any more - only data is
returned. A `ValidationError` is raised if validation fails. The code
now relies on the `marshmallow_validation_error` error handler to handle
errors instead of having to raise an `InvalidRequest`. This has no
effect on the response that is returned (a test has been modified to
check).

Also added a new `password` field to the `UserSchema` so that we don't
have to specially check for password errors in the `.create_user` endpoint
- we can let marshmallow handle them.
2022-05-25 11:35:44 +01:00
Ben Thorner
8e837cf681 Use table class directly instead of "table" var
In response to [^1].

[^1]: https://github.com/alphagov/notifications-api/pull/3546#discussion_r879541366
2022-05-24 10:16:28 +01:00