Commit Graph

4724 Commits

Author SHA1 Message Date
Katie Smith
bc619efc4e Count the number of pages in pre-compiled letters
We were already counting the billable units in PDFs that we generate.
We are now also counting the number of billable units in pre-compiled letters
and saving the result.
2018-02-28 16:14:25 +00:00
kentsanggds
0d2868625d Merge pull request #1720 from alphagov/ken-fix-failed-boto-mocks
Fix boto mocks in tests
2018-02-28 15:58:05 +00:00
Ken Tsang
b6401e4858 Fix boto mocks in tests
- was getting KeyError: 'Error' test failures due to the side_effect not generating enough information to be used in the ClientError class, this PR adds missing information.
2018-02-28 10:54:52 +00:00
Rebecca Law
d584ca4949 Merge pull request #1715 from alphagov/remove-deprecated-endpoint
Remove deprecated endpoints
2018-02-27 14:59:35 +00:00
Rebecca Law
12046ee85a There endpoint to check the token of an invitation for services and organisations have been merged.
This PR deletes the old endpoints.
2018-02-27 13:46:23 +00:00
Leo Hemsted
a87373571c Merge pull request #1714 from alphagov/reqs
bump requirements
2018-02-27 13:46:14 +00:00
Leo Hemsted
ab95a4501b bump requirements
notably, remove awscli and boto3 - they're both required by utils, and
are generating a lot of PR noise
2018-02-27 11:25:57 +00:00
kentsanggds
25d84af63e Merge pull request #1709 from alphagov/ken-fix-letter-serialization
Fix serialization on precompiled letter
2018-02-27 10:13:15 +00:00
Rebecca Law
6886cfcd82 Merge pull request #1710 from alphagov/org-user-endpionts
Fix db migration conflicts
2018-02-26 16:57:32 +00:00
Rebecca Law
0728c9f41a Fix db migration conflicts 2018-02-26 16:48:12 +00:00
Rebecca Law
7faf375375 Merge pull request #1695 from alphagov/org-user-endpoints
Organisation user endpoints
2018-02-26 16:27:01 +00:00
Ken Tsang
c14663d84a Fix serialization on precompiled letter
Postcodes are required for created letters, but not for precompiled, this fix allows postcodes to be None in the model.
As postcodes are still required for created letter they should be caught by validation schemas in the POST handler
2018-02-26 13:53:06 +00:00
Alexey Bezhan
8f08f691b2 Merge pull request #1708 from alphagov/non-nullable-hidden-templates
Set Templates.hidden column as non-nullable and filter hidden templates
2018-02-26 13:41:36 +00:00
Alexey Bezhan
984a5050db Don't return hidden templates in API service template responses
Brings back filtering hidden templates from the API responses.
2018-02-26 13:28:08 +00:00
Alexey Bezhan
dc99fe5ff3 Set Templates.hidden column as non-nullable
Sets hidden to false for all existing templates and makes column
non-nullable.
2018-02-26 13:28:08 +00:00
Alexey Bezhan
6ad868d22e Merge pull request #1707 from alphagov/dont-hide-hidden-templates-just-yet
Revert "Don't return hidden templates in API service template responses"
2018-02-26 11:54:01 +00:00
Alexey Bezhan
9b3a9a55c4 Revert "Don't return hidden templates in API service template responses"
Filtering out hidden templates requires all existing templates to
have `hidden` flag set, which can only be done by a migration after
the code that sets the flag to `False` by default for new templates
has been released.

This removes the filtering logic until the migration has been released.
2018-02-26 11:44:25 +00:00
Alexey Bezhan
b44f08bd0f Merge pull request #1706 from alphagov/nullable-template-hidden
Set Template.hidden as nullable before the new app code gets released
2018-02-26 10:56:06 +00:00
Alexey Bezhan
3a15a7e783 Set Template.hidden as nullable before the new app code gets released
Since the application code gets released after the migration setting
a new Template field as non-nullable prevents new templates from being
created by the existing application instances.

This splits the migration to set fields as nullable first and then
update existing records once the application code has been released.

0168 is modified not to run UPDATE query or set non-nullable flag in
staging and production. 0169 is added to rollback preview.
2018-02-26 10:46:20 +00:00
Alexey Bezhan
22382718e0 Merge pull request #1703 from alphagov/pre-compiled-letter-pdf-endpoint
Post pre-compiled letter PDF notification endpoint
2018-02-26 10:22:03 +00:00
Alexey Bezhan
19dbe7da8d Don't return hidden templates in API service template responses
Removes hidden templates from the service templates list and returns
404 when searching for a hidden template or template versions by ID.
2018-02-23 17:52:25 +00:00
Alexey Bezhan
d803b48d23 Return 400 response for invalid per-compiled letter content 2018-02-23 17:52:25 +00:00
Alexey Bezhan
bef91bcd99 Check for precompiled letter permission in the post notification 2018-02-23 17:52:25 +00:00
Alexey Bezhan
8971a5adce Upload pre-compiled letter PDF to S3
Pre-compiled letter endpoint uploads PDF contents to S3 directly
instead of creating a letter task to generate PDF using template
preview.

This moves some of the utility functions used by existing letter
celery tasks to app.letters.utils, so that they can be reused by
the API endpoint.
2018-02-23 17:52:25 +00:00
Alexey Bezhan
5327298371 Add a view function for pre-compiled PDF letters
Adds a separate view function that is registered under the same
route as existing letter POST notification.
2018-02-23 17:52:24 +00:00
Alexey Bezhan
e659253b01 Set Notify service user as the creator of Pre-compiled PDF template 2018-02-23 17:52:24 +00:00
Alexey Bezhan
6d1439e39a Add a DB migration to create Templates.hidden column
Creates the column as nullable, sets the value to false for all
existing templates and template versions and then applies a
not-nullable constraint.

All future Templates are created with `False` as the default set
in SQLAlchemy.
2018-02-23 17:52:24 +00:00
Rebecca Law
466aabdbea Added a new endpoint that can be used for organisation or service invitations.
The other two invitation endpoints will be removed once the admin app is updated.
2018-02-23 14:15:39 +00:00
Alexey Bezhan
c4fddab6a6 Add a hidden column to templates
Allows hiding templates from the templates list in the admin app
and related API responses.

This is used for 'internal' templates that we create for notifications
that wouldn't have a template otherwise (eg pre-compiled PDF letters)
2018-02-23 13:38:15 +00:00
Rebecca Law
446e76f1f3 Remove users relationship in organisations 2018-02-23 13:36:42 +00:00
Rebecca Law
7c44171a40 Fix merge conflict in db migration script 2018-02-23 10:57:24 +00:00
Rebecca Law
69cc33f77f Removed the check for active user when adding a user to an organisation 2018-02-23 10:45:18 +00:00
Rebecca Law
70f9dfc0f6 Added more tests 2018-02-23 10:45:18 +00:00
Rebecca Law
011f93c495 Adding more unit tests 2018-02-23 10:45:18 +00:00
Rebecca Law
13ef2d7bae - new endpoint to check the token for an org invitation.
- new endpoint to add user to organisation
- new endpoint to return users for an organisation
2018-02-23 10:45:18 +00:00
Leo Hemsted
57a174aeb4 add tests for org invite rest, and update conftest 2018-02-23 10:45:18 +00:00
Leo Hemsted
0d9aa5c531 add schema and hook up blueprint 2018-02-23 10:45:18 +00:00
Leo Hemsted
5b71d2f36e add org invite template to db 2018-02-23 10:45:18 +00:00
Leo Hemsted
a2a1c5e9af add organisation invite rest and dao 2018-02-23 10:45:18 +00:00
Rebecca Law
444dba994d Merge pull request #1698 from alphagov/add-exception-for-failed-letters
Added a new exception type for DVLAException
2018-02-23 10:42:10 +00:00
Leo Hemsted
c52ca3e7bb Merge pull request #1681 from alphagov/fix-test-db
make sure tests always run in test db
2018-02-22 16:54:57 +00:00
Rebecca Law
385653af44 Added a new exception type for DVLAException.
The Notify team needs to investigate when a notification is marked as failed.
We will process the whole file and mark the notifications with the appropriate status, if any are failed an exception is raised.
The exception will trigger a cloud watch error for the team to investigate.
2018-02-22 15:05:37 +00:00
Leo Hemsted
25d6b45ea2 Merge pull request #1692 from alphagov/service-name-change
don't return or accept sms_sender in update service anymore
2018-02-22 14:37:47 +00:00
Sakis
18a85a080d Merge pull request #1693 from alphagov/increase-pool-size
Increase DB connection pool size to 10
2018-02-22 11:33:53 +00:00
Leo Hemsted
aedbd37d8b don't return or accept reply_to_email in update service anymore
either
2018-02-22 11:03:35 +00:00
kentsanggds
c01aef2c48 Merge pull request #1694 from alphagov/ken-add-precompiled-letter-permission
Add precompiled_letter service permission
2018-02-22 10:27:52 +00:00
Athanasios Voutsadakis
c61ed043b3 Ensure pool size is an integer 2018-02-22 10:27:02 +00:00
Leo Hemsted
ee1be970fc make test config inherit from dev config
gets some secret keys and things set up for free
2018-02-21 18:42:24 +00:00
Leo Hemsted
073c48a0a7 move all static env vars from env.sh to config file in dev
There's no reason to have things that never change in environment.sh.
you'll want to update your environment.sh, then restart your shells
(`exec bash` or `exec zsh` etc)

This also changes the database to be set statically in the config, but
overridable from the command line if you need to - for example, jenkins
will override it with the dockerised postgres uri.
2018-02-21 18:12:03 +00:00
Ken Tsang
90e9d99161 Add precompiled_letter service permission
- migration script to add precompiled_letter in service_permission_types table and in service permission types list in models.py
2018-02-21 16:26:49 +00:00