Commit Graph

8982 Commits

Author SHA1 Message Date
Jim Moffet
63bbd288ad test pre-commit hook 2022-06-27 15:05:01 -07:00
Jim Moffet
88231c1c8c test pre-commit hook 2022-06-27 15:04:33 -07:00
Jim Moffet
2eb5916395 test pre-commit hook 2022-06-27 15:01:30 -07:00
Jim Moffet
fdc602b6f2 clean up 2022-06-27 08:30:32 -07:00
Jim Moffet
3f53ba3e50 Merge pull request #11 from 18F/jim/062522/configupdates
clean up config
2022-06-25 18:38:52 -07:00
Jim Moffet
2047cec495 Merge branch 'main' into jim/062522/configupdates 2022-06-25 18:37:13 -07:00
Jim Moffet
ac8d8d3c29 clean up config 2022-06-25 18:36:39 -07:00
Jim Moffet
57c2919dca Merge pull request #9 from 18F/jim/062522/smsclientfixes
initial sms provider cleanup
2022-06-25 13:16:33 -07:00
Jim Moffet
6a4f34750e clean up 2022-06-25 13:13:12 -07:00
Jim Moffet
2bcae20441 initial sms provider cleanup 2022-06-25 13:05:10 -07:00
Christa Hartsock
64c45e0543 Merge pull request #8 from 18F/ch/cf-deploy
Run worker process on deploy
2022-06-23 15:50:30 -07:00
Christa Hartsock
64cca93c1b Collapse worker into Procfile from wrapper 2022-06-23 15:46:19 -07:00
Christa Hartsock
a9d79021ca Rename deployment env file to varsfile 2022-06-23 14:17:53 -07:00
Christa Hartsock
c414437eb4 Merge pull request #6 from 18F/ch/cf-deploy
Deployment of web server from web server
2022-06-23 14:05:44 -07:00
Christa Hartsock
b0f8a51f99 Move config into manifest, update for SNS provider
Keeps secrets in .env files
2022-06-23 13:45:58 -07:00
Christa Hartsock
7319708172 Use statsd local host instead of GDS 2022-06-23 13:39:05 -07:00
Christa Hartsock
3cd15e97e2 Update manifest to use proper templates for vars-file 2022-06-23 13:39:05 -07:00
Christa Hartsock
e773f937ed WIP: local deployment 2022-06-23 13:39:05 -07:00
Jim Moffet
5ff11b001d Merge pull request #5 from 18F/jim/061522/sns-integration
Jim/061522/sns integration
2022-06-23 13:17:31 -07:00
Jim Moffet
4030f9c8d7 config buckets 2022-06-23 13:05:09 -07:00
Jim Moffet
70143301ce Merge pull request #2 from 18F/local-dev-upgrades
add devcontainer configs and docker network orchestration
2022-06-17 11:23:11 -07:00
Jim Moffet
aa4ec532a4 implement SNS 2022-06-17 11:16:23 -07:00
Jim Moffet
79ba6cc1d1 disable cache persistence & env updates 2022-06-13 21:42:36 -07:00
Jim Moffet
e88e36712f sample env 2022-06-13 14:50:22 -07:00
Jim Moffet
f5beb23a1d rm deprecated config 2022-06-13 13:48:30 -07:00
Jim Moffet
60262d6031 config formatting 2022-06-13 13:45:07 -07:00
Jim Moffet
59b72f4853 add devcontainer configs and docker network orchestration 2022-06-13 13:16:32 -07:00
Ben Thorner
e604385e0c Merge pull request #3551 from alphagov/bump-utils-56
Bump utils to version 56.0.0
2022-06-01 16:02:17 +01:00
Ben Thorner
ee8e86f409 Bump utils to version 56.0.0
The only impactful change is the major version itself, where I've
fixed the breaking changes due to the upgrade of PyPDF2 [^1] and
checked there are no deprecation warnings when I run the tests.

[^1]: https://github.com/alphagov/notifications-utils/pull/973
2022-06-01 14:27:25 +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