Chris Hill-Scott
c38962e91a
Only put a character limit on SMS notifications
...
We limit SMS to be a maximum of 495 characters at the point of an
API call being made.
We were also applying this limit to emails, which is wrong.
2016-07-21 16:33:21 +01:00
Adam Shimali
9f9040869d
Daily message limit imposed for service api calls.
2016-07-14 11:25:45 +01:00
Chris Hill-Scott
aa12c88551
Add a test for sending email to provider
...
We had a test like this for sending sms, but not email. This meant that,
for example, we weren’t checking that the provider was getting passed
the HTML and plain text versions of the email.
2016-07-08 11:16:45 +01:00
Chris Hill-Scott
bb3c55ca6c
Make send sms test use a template with a newline
2016-07-08 11:16:45 +01:00
Chris Hill-Scott
a8a556d02a
Use PassThrough renderer
...
Implements and depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/49
2016-07-07 22:48:07 +01:00
Leo Hemsted
96513442fe
notifications from test api keys dont send for real - a la research_mode
...
also added a bunch more tests around api keys to help ensure we're behaving in at least a consistent way
2016-07-05 16:29:53 +01:00
Leo Hemsted
eee98e3e52
move callback tests into separate file
...
also fix syntax errors
2016-07-05 16:20:03 +01:00
Leo Hemsted
011afa4b16
make tests parametrized for all three key types
2016-07-05 16:20:02 +01:00
Leo Hemsted
2cf1d22748
add filters to GET /notifications endpoints to only return for provided key_type
...
if api_key used to access endpoint is type team, endpoints only return that type -
will 404 if you provide a different ID. Same applies for normal (normal api keys
cannot see team notifications)
also, for convenience, set sample_notification to supply key_type of KEY_TYPE_NORMAL
by default
2016-07-01 14:35:02 +01:00
Leo Hemsted
01419e7894
store api_key_id and key_type on notification
...
pass through from POST /notification/<type> to the celery task
also removed a couple of asserts that can fail (based on unfrozen time comparisons)
2016-07-01 14:35:02 +01:00
Leo Hemsted
5ae7ed1acb
only send to team emails/phones if POST /notificaiton/<type> with team api_key
...
uses same restriction as a service in trial mode
2016-07-01 14:33:25 +01:00
Leo Hemsted
2b645f490a
move get_all_notifications_for_service and get_all_notifications_for_job
...
moved from notifications/rest -> service/rest and job/rest respectively
endpoint routes not affected
removed requires_admin decorator - that should be set by nginx config
as opposed to python code
2016-06-30 10:44:21 +01:00
Rebecca Law
8435217808
Fix new test for the default status of a notification
2016-06-27 15:02:53 +01:00
Rebecca Law
48e64abd81
Merge branch 'master' into notification-created-status
2016-06-27 14:59:56 +01:00
Rebecca Law
8a0211b3eb
Only send to the provider if the notification has a created status.
...
If the notification ends up in the retry queue and the delivery app is restarted the notification will get sent twice.
This is because when the app is restarted another message will be in the retry queue as message available which is a
duplicate of the one in the queue that is a message in flight.
This should complete https://www.pivotaltracker.com/story/show/121844427
2016-06-27 14:47:20 +01:00
Adam Shimali
3423c0c44d
Added subject for email templates
2016-06-23 15:21:03 +01:00
Adam Shimali
f65b86cfc9
Body of notification without placeholder should have been present.
2016-06-23 10:25:07 +01:00
Adam Shimali
ed5bdb7be8
Merge pull request #467 from alphagov/notification-created-status
...
Notification created status for send_sms
2016-06-23 10:21:43 +01:00
Leo Hemsted
c92138d5ab
return replaced subject back from get notifications API
2016-06-22 16:24:34 +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
Leo Hemsted
5cd3043fc5
return replaced subject back from send_notification API
2016-06-21 15:03:33 +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
Adam Shimali
dd8372a572
Updated for git comments
2016-06-17 10:15:57 +01:00
Adam Shimali
db22373a6b
Endpoint for reading notification stats for a given day.
2016-06-16 17:02:33 +01:00
Leo Hemsted
2b13033e85
add template body, version, and subject to send_notification api
2016-06-15 14:51:35 +01:00
Leo Hemsted
d0eca79417
move all send_notification tests to separate file
2016-06-15 12:27:57 +01:00
Rebecca Law
470bf7281a
Merge pull request #420 from alphagov/use-notify-to-send-email-verification-links
...
Use notify to send email verification links
2016-06-14 17:00:28 +01:00
Rebecca Law
4c34238a88
Fix send_email task requested from notifications endpoint.
2016-06-14 16:53:52 +01:00
Chris Hill-Scott
7f7743b389
Test for filtering a job by notification status
...
It’s going to be useful to see all the notifications for a job that are
failed/delivered/etc.
The API seems to support this behaviour already, but it doesn’t seem to
be tested.
This commit adds some testsfor the DAO and REST layers.
2016-06-14 14:07:54 +01:00
Rebecca Law
a6ce109c62
Rename first send_email to send_email_v1.
...
Fix the tests
2016-06-13 16:16:56 +01:00
Rebecca Law
cd2627e5ed
Create a new task called send_email_v2 so that I can get rid of the from_address in the signature.
...
This is done to make sure we do not lose any messages in the queue during deployment.
2016-06-13 15:31:45 +01:00
Rebecca Law
c9f1eb65a7
Build the from address in the task instead of the rest call.
2016-06-13 14:57:59 +01:00
Leo Hemsted
a487931323
python 34 compatibility
2016-06-02 16:49:34 +01:00
Leo Hemsted
54a1adfe8b
fix copypasta error with ses test
2016-06-02 16:30:40 +01:00
Leo Hemsted
d41048f4aa
statsd counters for callback statuses
...
also for the 'code' param from firetext
2016-06-02 15:53:04 +01:00
Rebecca Law
2bfa9b7e10
Merge branch 'master' into permanent-failure-firetext
2016-05-27 12:10:59 +01:00
Leo Hemsted
a90a18541f
notifications/statistics returns when no stats exist for today
...
moved filtering from WHERE to JOIN ON so that when join suceeds but filter fails, we dont lose the service's data from the results set
2016-05-26 16:48:30 +01:00
Rebecca Law
25a1b7f31c
Firetext does not have a status code for temporary-failure.
...
In order to set a message as temporary-failure, we check if it is in pending status first.
Otherwise a delivery receipt for failure is set to permanent failure.
2016-05-26 16:46:00 +01:00
Rebecca Law
fa152c4431
Mark a declined message from Firetext as permanent-failure rather than failed.
2016-05-24 15:32:48 +01:00
Leo Hemsted
24625a44f3
prevent public api from sending archived templates
2016-05-24 13:08:38 +01:00
Rebecca Law
cf2723bdc9
If the sms client provider sends more than one delivery receipt only take the update for the the first one.
...
Only update the notification.status if status = sending.
2016-05-20 17:04:56 +01:00
Leo Hemsted
81e5eb2c0a
return all zeros when NotificationStatistics dont exist
2016-05-20 15:24:57 +01:00
Leo Hemsted
1b27c15c16
/notifications/statistics now takes 'day' parameter
...
avoids potential issues with date.today being inconsistent with user timezone
2016-05-20 11:31:35 +01:00
Leo Hemsted
f7768366a1
added test_notification_statistics file
...
put in new rest subfolder in anticipation of refactoring test_rest.py
2016-05-20 09:57:31 +01:00
NIcholas Staples
e0f6b4e571
Merge pull request #327 from alphagov/add_job_row_number
...
Added job row number to the notification for csv jobs. All tests pass…
2016-05-19 14:33:21 +01:00
Adam Shimali
955005d7fe
Added additional outcome status codes to mmg responses.
2016-05-19 11:27:22 +01:00
Nicholas Staples
0fe0c1d2b4
Added job row number to the notification for csv jobs. All tests passing.
2016-05-19 10:46:03 +01:00
Nicholas Staples
c46216dd96
Fix test to check for decrypted dictionary value.
2016-05-18 14:28:19 +01:00
Rebecca Law
281a93b32d
Update ses callback to interpret hard and soft bounces.
...
If the notification has a status == sending then update the status otherwise do not update the status.
In other words do not change the status more than once.
2016-05-17 15:38:49 +01:00
minglis
3c751d94a4
Merge pull request #309 from alphagov/statsd-integration
...
Statsd integration
2016-05-16 12:29:14 +01:00