Commit Graph

1780 Commits

Author SHA1 Message Date
Rebecca Law
fa422a85ef Fix unit test failure 2016-11-22 13:25:10 +00:00
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
Rebecca Law
1345c94f4b Merge pull request #736 from alphagov/implement-v2-send-email
Implemented the post email notifications endpoint for v2
2016-11-17 15:47:22 +00:00
Rebecca Law
f5e3c6f63b Remove print stmt and added assert error content 2016-11-17 14:02:44 +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
dc5e21a78e Remove v2 error handler for InvalidPhoneError, no longer expect to throw this exception. 2016-11-17 09:09:24 +00:00
Rebecca Law
df62be421f Make email_from and subject required attributes of the email_content schema.
Update the format_checkers to raise the specific exception that why the validator can handle multiple messages.
Which led to a refactor of build_error_message.
2016-11-16 17:25:00 +00:00
Rebecca Law
68537d960a Merge branch 'master' into implement-v2-send-email 2016-11-16 16:29:41 +00:00
Rebecca Law
34d9c44163 Merge pull request #739 from alphagov/refactor-for-reuse-fix
Fix functional tests
2016-11-16 16:24:03 +00:00
Rebecca Law
247668202b Fix functional tests 2016-11-16 16:15:30 +00:00
Leo Hemsted
9da0cc84bd Merge pull request #738 from alphagov/leohemsted-patch-1
typo
2016-11-16 16:11:29 +00:00
Leo Hemsted
a51dfb41d0 typo
paul tried to copy + paste command
2016-11-16 16:11:23 +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
a3eeb1a477 Merge branch 'master' into implement-v2-send-email 2016-11-16 15:18:03 +00:00
Rebecca Law
80f3bfcb2c Merge pull request #733 from alphagov/refactor-for-code-reuse
Refactor for code reuse
2016-11-16 15:17:30 +00:00
Rebecca Law
d6c537cf44 Added job_id and row_number to the exception error message if the task needs to be retried. That way we have a way to tie the exception messages together 2016-11-15 11:44:48 +00:00
Leo Hemsted
61a166193c Merge pull request #737 from alphagov/dont-deactivate-twice
archive service - don't re-delete templates etc
2016-11-14 17:04:52 +00:00
Rebecca Law
2d9d4013e8 Missed one 2016-11-14 15:29:23 +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
Leo Hemsted
d706d86c9c don't re-delete already archived/revoked templates/api-keys 2016-11-14 14:10:40 +00:00
Chris Hill-Scott
e2de83a1b2 Merge pull request #730 from alphagov/letter-templates
Add ‘letter’ as a possible template type
2016-11-14 15:09:28 +01:00
Rebecca Law
b0ee09a9f6 Implemented the post email notifications endpoint for v2 2016-11-14 13:56:09 +00:00
Rebecca Law
4379308189 Fix test failures. 2016-11-11 17:28:15 +00:00
Chris Hill-Scott
28d5da638b Remove old style fixture
Use new `client` one instead
2016-11-11 17:05:41 +00:00
Rebecca Law
8f0a96c76c Merge branch 'master' into refactor-for-code-reuse 2016-11-11 16:51:18 +00:00
Chris Hill-Scott
6127ee422a Test can get letter template
It works already, just making sure it stays working.
2016-11-11 16:47:07 +00:00
Chris Hill-Scott
73fe331dc8 Test can create letters template
It works already, just making sure it stays working.
2016-11-11 16:47:06 +00:00
Chris Hill-Scott
f34b58e7cd Delete redundant test
Not needed now that the test above this one is parametrized.
2016-11-11 16:47:06 +00:00
Chris Hill-Scott
aef62dcffb Parametrize template create
Cleaner than having two almost identical tests.
2016-11-11 16:47:06 +00:00
Chris Hill-Scott
705a0e7ab8 Remove redundant assignment
This variable is used exactly once, on the next line 🤔
2016-11-11 16:47:06 +00:00
Chris Hill-Scott
3e6d581f73 Use constants for template type
Handy if we ever want to rename these I guess…
2016-11-11 16:47:05 +00:00
Chris Hill-Scott
eb17822564 Merge pull request #734 from alphagov/fix-conflicting-migration-versions
Fix conflicting migration versions
2016-11-11 17:45:55 +01:00
Chris Hill-Scott
35e1e06db4 Fix conflicting migration versions
Two different versions of 0059 were merged.

`0059_set_services_to_active` was merged first, so this renames my
migration to `0060`, so it goes in afterwards.
2016-11-11 16:30:05 +00:00
Chris Hill-Scott
7ada78a0b6 Merge pull request #731 from alphagov/letter-templates-db
Add letter to possible template types in DB
2016-11-11 17:13:33 +01:00
Rebecca Law
4f5254134b Fix logging in send_sms and send_email 2016-11-11 16:09:09 +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
Leo Hemsted
95764af6ea Merge pull request #723 from alphagov/active-service
deactivate a service
2016-11-11 15:25:32 +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
Leo Hemsted
195f3615e6 add test that if we have an exception, nothing is committed 2016-11-11 14:40:25 +00:00
imdadahad
10f9dfde6e Merge pull request #725 from alphagov/update-user-profile-endpoints
Refactor saving user profile
2016-11-11 11:24:31 +00:00
Leo Hemsted
9ae6e14140 move deactivate functionality into one database transactions
this means that any errors will cause the entire thing to roll back

unfortunately, to do this we have to circumvent our regular code, which calls commit a lot, and lazily loads a lot of things, which will flush, and cause the version decorators to fail. so we have to write a lot of stuff by hand and re-select the service (even though it's already been queried) just to populate the api_keys and templates relationship on it
2016-11-11 11:20:41 +00:00
Rebecca Law
2e4fab1b55 Merge pull request #732 from alphagov/change-v2-error-resp
Change v2 error resp
2016-11-11 11:07:59 +00:00
Rebecca Law
488ba7a1ef Remove import 2016-11-11 10:56:21 +00:00
Rebecca Law
b0d88e0888 Removed OrderedDict
Added missing assert in test
2016-11-11 10:50:38 +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
Chris Hill-Scott
6501a871bc Add letter to possible template types in DB
A letter type was added to the `enum` in the `Template` model at the
same it was added to the `Notification` model. But the migration was
only done for the `notifications` table, not the `templates` table.

See: https://github.com/alphagov/notifications-api/commit/25db1bce#diff-516aab258e161fc65e7564dabd2c625aR19

This commit does the migration to add `letter` as a possible value for
the `template_type` column, which is a bit fiddly because `enum`s.

Before:
```
notification_api=# select enum_range(null::template_type);
 enum_range
-------------
 {sms,email}
(1 row)
```

After upgrade:
```
notification_api=# select enum_range(null::template_type);
     enum_range
--------------------
 {sms,email,letter}
(1 row)
```

After downgrade
```
notification_api=# select enum_range(null::template_type);
 enum_range
-------------
 {sms,email}
(1 row)
```
2016-11-11 10:41:09 +00:00
Chris Hill-Scott
d51c63cb6b Merge pull request #722 from alphagov/whitepace-in-personalisation
Ignore case and whitespace in personalisation keys
2016-11-11 11:33:37 +01:00
Rebecca Law
c758694b98 Change validation error message to a string from a dict. 2016-11-10 16:30:51 +00:00
Rebecca Law
7d763260ce Update format of the errors for DataError and exception 2016-11-10 14:53:39 +00:00
Rebecca Law
26d6a0c1a9 Merge branch 'master' into change-v2-error-resp 2016-11-10 14:21:20 +00:00