Commit Graph

114 Commits

Author SHA1 Message Date
Rebecca Law
46beece158 For the post_sms_response and post_email_response the reference property is always present but the value can be null.
Added a test for an empty reference.
Remove datetime format on the created_at attribute of a notification, it is not needed.
2016-11-21 17:32:36 +00:00
Martyn Inglis
58bbc5a5aa Now that we have discovered that the catch all Exception handler doesn't work, I've created a custom exception (SendNotificationQueueError) that handles this case and an error handler for it.
Talked these through with @becca as an approach.
2016-11-21 15:11:19 +00:00
Martyn Inglis
7cfc58c994 Merge branch 'master' into caching-with-redis
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
2016-11-21 13:10:22 +00:00
Rebecca Law
bc434f1736 Create new column in notifications and notification_history to store the client_reference because I remembered that reference is used for email providers. 2016-11-17 13:42:34 +00:00
Rebecca Law
924cec05b4 Included reference when persisting the notification.
This was already part of the data model.
Not included in the send_sms|email task because there is no reference from the job.
2016-11-16 15:44:16 +00:00
Rebecca Law
c00eb0f5a4 Remove from_request method on the Notification db model, was not needed anymore.
Use Notifications.query.one(), rather than assert count is 1 and query for all and get first item in list.
2016-11-14 14:41:32 +00:00
Rebecca Law
4fe8d700ae Fix the send_sms and send_email code to send the notification id that has been persisted. 2016-11-11 16:00:31 +00:00
Rebecca Law
c45d1f63a7 Use the same method to persist a notification.
Refactored the send_sms task to use this method.
2016-11-11 14:56:33 +00:00
Rebecca Law
eafbbd9809 Refactor send_sms and send_email to use common code to persist the notificaiton. 2016-11-11 10:41:39 +00:00
Rebecca Law
fc298367c5 Updated test_validators to test the contents of the error messages.
Added some tests to the test_post_notifications.
Added a errorhandler for AuthErrors.

This endpoint is not being used anywhere, however there is some common code being used in the v1 post endpoint. The only thing that may be affected is the error response, hopefully they are the same.
2016-10-31 12:22:26 +00:00
Rebecca Law
8cf2fc72a8 - Refactor version 1 of post notificaitons to use the common persist_notificaiton and send_notification_to_queue methods.
- It would be nice to refactor the send_sms and send_email tasks to use these common functions as well, that way I can get rid of the new Notifications.from_v2_api_request method.
- Still not happy with the format of the errors. Would like to find a happy place, where the message is descript enough that we do not need external documentation to explain the error. Perhaps we still only need documentation to explain the trial mode concept.
2016-10-28 17:10:00 +01:00
Rebecca Law
6e4bad135a - Implemented persist_notification and send_notification_to_queue in the process_notifications module
- Not sure I want to create a new classmethod on Notifications to create from v2 request. Will take another look at that.
2016-10-27 17:34:54 +01:00
Rebecca Law
c2eecdae36 - Add validation methods for post notification.
- Use these validation methods in post_sms_notification and the version 1 of post_notification.
- Create a v2 error handlers.
- InvalidRequest has a to_dict method for private and v1 error responses and a to_dict_v2 method to create the v2 of the error responses.
- Each validation method has extensive unit tests, so the unit test for the endpoint do not need to check every error case, but check that the error handle formats the message correctly.
- The format of the error messages is still a work on progress.
- This version of the api could be deployed without causing a problem to the application.
- The new endpoing is still a work in progress and is not being used yet.
2016-10-27 11:46:37 +01:00
Rebecca Law
23a4f00e56 New package structure for the version 2 of the public api.
Start building up the validators required for post notificaiton.
The app/v2/errors.py is a rough sketch, will be passed a code, the error can look up the message and link for the error message.
2016-10-25 18:04:03 +01:00