Commit Graph

1412 Commits

Author SHA1 Message Date
Rebecca Law
11ac7b2874 Merge branch 'master' into notification-created-status
Conflicts:
	app/dao/notifications_dao.py
2016-06-22 16:15:56 +01:00
Rebecca Law
5f29815870 Merge pull request #464 from alphagov/refactor-api-key
Refactor the api_key_dao.
2016-06-22 15:57:38 +01:00
Leo Hemsted
93618d2a7e make test db return order-agnostic 2016-06-22 15:56:41 +01:00
Rebecca Law
2e63a7e2af Merge pull request #462 from alphagov/allow-created-notifications-to-be-updated
Added created as a status type that can be updated.
2016-06-22 15:56:41 +01:00
Rebecca Law
acee87fc63 Refactor the api_key_dao.
The only update we should be doing to an api key is to expire/revoke the api key.
Removed the update_dict from the the save method.
Added an expire_api_key method that only updates the api key with an expiry date.
2016-06-22 15:27:28 +01:00
Leo Hemsted
bffeaa773a Remove db.drop_all from notify_db session fixture to speed up tests
We were dropping all tables at the end of the test run, however the alembic_version table is not part of the metadata so was being persisted. Alembic then doesn't upgrade the database next test run, since the version appears up to date, so we were, in the notify_db_session fixture, recreating from MetaData (sqlalchemy models). This involves quite a costly comparison of the postgres system tables and the tables in models.py, which was adding half a second to each test that uses the notify_db_session fixture (virtually all of them).
2016-06-22 15:22:16 +01:00
Rebecca Law
23dfa2d535 Added created as a status type that can be updated. 2016-06-22 14:42:55 +01:00
Rebecca Law
fcb5ca9ef4 The send_sms task will created the notification with a status = created.
The encrypted_notification for the send_sms_to_provider task has been made optional.
2016-06-22 13:32:27 +01:00
Rebecca Law
1659b64f9e Merge pull request #458 from alphagov/fix-downgrade
Fix downgrade to work if any notifications have status = 'created'
2016-06-21 16:09:12 +01:00
Rebecca Law
7f4d048d75 Fix downgrade to work if any notifications have status = 'created' 2016-06-21 15:55:39 +01:00
Rebecca Law
3d3bff25a8 [WIP] updating notification to start in the created status 2016-06-21 15:51:30 +01:00
Leo Hemsted
5cd3043fc5 return replaced subject back from send_notification API 2016-06-21 15:03:33 +01:00
Rebecca Law
b17aaaabfb Set a notification.status=created in the send_sms task 2016-06-21 14:38:17 +01:00
Rebecca Law
fa20e67941 Merge pull request #457 from alphagov/notification-created-status
Add created as a status for notifications
2016-06-21 13:56:53 +01:00
Rebecca Law
131b0cb017 Merge pull request #452 from alphagov/move-scheduler-tasks
Move scheduler tasks
2016-06-21 13:56:40 +01:00
Rebecca Law
8caa688bf5 Add created as a status for notifications 2016-06-21 13:41:46 +01:00
Rebecca Law
2a9a8ae70e remove print in test 2016-06-21 11:28:18 +01:00
Rebecca Law
6c81d0f465 Merge branch 'master' into move-scheduler-tasks
Conflicts:
	tests/app/celery/test_tasks.py
2016-06-21 11:24:26 +01:00
Adam Shimali
4cb67e8767 Merge pull request #454 from alphagov/store-notification-personalisation
Store personalisation with notification
2016-06-21 10:57:14 +01:00
Adam Shimali
731bb19a9c Template and personalisation content is now merged and returned with
notifications, when retrieved by notification id, or service id (i.e.
all notifications for service).

There is a new element returned at top level of notification json called
body, which is the template content merged with personalisation. This
is consistent with api to endpoint to create notification which returns
what was sent as 'body' in json response.

Merging of template with personalisation is done in the
NotificationStatusSchema.

Personalisation data in encrypted before storing in db.
2016-06-20 16:49:17 +01:00
Rebecca Law
2da6226ace Add scheduled_tasks to celery_import config 2016-06-20 13:44:24 +01:00
minglis
561b02208d Merge pull request #451 from alphagov/staging-live-visibility-update
Update visibility timeout on staging and live
2016-06-20 13:39:13 +01:00
Rebecca Law
316b5d0e64 Move scheduled tasks into their own module.
There is no change to the functionality - only moving the code around.
2016-06-20 13:33:53 +01:00
Martyn Inglis
7d5c25bd48 Update visibility timeout on staging and live 2016-06-20 13:30:57 +01:00
minglis
a786005474 Merge pull request #414 from alphagov/split-sms-and-retry
Split sms and retry
2016-06-20 12:23:36 +01:00
Rebecca Law
66c9c5fa16 Merge pull request #445 from alphagov/add-coveralls
Add code coverage
2016-06-20 10:21:11 +01:00
Rebecca Law
6ee26bb109 Merge pull request #441 from alphagov/consistent-json-responses
Update auth module to return consistently formed error messages.
2016-06-20 10:19:46 +01:00
Chris Hill-Scott
4f145c245a Add code coverage 2016-06-17 17:09:50 +01:00
Martyn Inglis
838bf1d7d4 Merge branch 'master' into split-sms-and-retry
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
2016-06-17 16:39:03 +01:00
Martyn Inglis
51c6d57a86 Changed the delay period. Now waits
10 seconds, 1 minute, 5 minutes, 1 hour and 4 hours.

Total elapsed wait is max 5 hours 6 minutes and 10 seconds.

Changed visibility window of SQS to be 4 hours 10 seconds, longer the max retry period.
2016-06-17 16:32:56 +01:00
Chris Hill-Scott
9a79f0fbbb Merge pull request #432 from alphagov/replace-placeholders-template
Add a ‘preview template’ endpoint
2016-06-17 15:30:04 +01:00
Rebecca Law
d9ac254498 Merge pull request #440 from alphagov/clean-up-tasks
Remove the invitation email and reset password email tasks.
2016-06-17 14:25:51 +01:00
Rebecca Law
40fa394226 Update auth module to return consistently formed error messages.
We are trying to get all the error messages to return in the following format:
{result: error,
 message: ['what caused error': 'reason for error']
}
2016-06-17 14:22:58 +01:00
Rebecca Law
fa6ae864d6 Remove the invitation email and reset password email tasks. 2016-06-17 13:49:33 +01:00
Chris Hill-Scott
0d9519c656 Remove wrapper around response object
Before:
```json
{'data': {'template': '…'}}
```

There’s no need to wrap the response in key because there will only
ever be one valid key for the template preview endpoint.

Flatter is better:
```json
{
  'content': '…',
  'subject': '…',
  'template_type': '…',
  …
}
```

The response will be different if there’s an error, but you should be
checking the status code first anyway.

This commit:
- changes the template preview endpoint to return the above format
- adds a test to make sure that the original `/service/…/template/…`
  endpoint still returns JSON in the same format (with a `data` key)
2016-06-17 12:57:43 +01:00
Adam Shimali
5378e6ebc1 Merge pull request #434 from alphagov/notification-stats-by-day
Endpoint for reading notification stats for a given day.
2016-06-17 12:03:40 +01:00
Rebecca Law
595a1d04db Merge pull request #435 from alphagov/use-notify-to-send-forgot-password
Use notify to send forgot password and invitation emails
2016-06-17 11:07:25 +01:00
Rebecca Law
4e640eea6d Remove print 2016-06-17 11:01:26 +01:00
Rebecca Law
2a142dd36b Merge pull request #429 from alphagov/refactor-query-filters
Refactor permissions dao
2016-06-17 10:55:40 +01:00
Adam Shimali
dd8372a572 Updated for git comments 2016-06-17 10:15:57 +01:00
Chris Hill-Scott
cf91ce57fc Add a ‘preview template’ endpoint
There’s a need for users of the API to be able to take advantage of
Notify’s template rendering.

For example, there’s a service that’s building a case management system.
Their users are sending emails on a case-by-case basis. Before they
send an email, it’s ressuring to double check that the right data is
being inserted, that the right template is being used, etc.

This commit:
- adds a separate endpoint for previewing a template, with
  personalisation taken from the get parameters of the request
- beefs up the tests around getting a template

Not part of this pull request:
- making this enpoint publicly accessible
2016-06-17 09:19:22 +01:00
Rebecca Law
3766d30d07 Merge pull request #428 from alphagov/rename-tasks-final-deploy
Remove the extra task
2016-06-16 17:43:42 +01:00
Rebecca Law
95c687b649 Merge branch 'master' into refactor-query-filters 2016-06-16 17:39:58 +01:00
Rebecca Law
b6c6b25032 Use the send email task to send the password reset and invitation email.
Next PR can remove those tasks.
2016-06-16 17:34:33 +01:00
Adam Shimali
db22373a6b Endpoint for reading notification stats for a given day. 2016-06-16 17:02:33 +01:00
Leo Hemsted
f7ceaf9009 Merge pull request #426 from alphagov/api-template-response
add template body, version, and subject to send_notification api
2016-06-16 11:36:08 +01:00
Rebecca Law
d6e920fa89 Use GOV.UK Notify service to send the forgot password email link using the template to create the message. 2016-06-16 10:43:41 +01:00
Rebecca Law
39c9d9ebe9 Merge branch 'master' into refactor-query-filters
Conflicts:
	app/permission/rest.py
2016-06-16 10:26:17 +01:00
Adam Shimali
92fdba7010 Merge pull request #424 from alphagov/more-error-logging
Make errors return via error handlers in errors.py
2016-06-16 09:34:20 +01:00
Rebecca Law
3c912b6cee Merge branch 'master' into rename-tasks-final-deploy
Conflicts:
	app/celery/tasks.py
2016-06-15 16:49:20 +01:00