Commit Graph

2113 Commits

Author SHA1 Message Date
Martyn Inglis
35aa888658 When creating a notification don't create a history row if:
1) research mode service
2) test mode key

Stop test data getting into history and subsequently into stats and so on.
2016-12-19 13:57:06 +00:00
imdadahad
fb114f4c80 Merge pull request #772 from alphagov/fix-v2-uri
Fix uri validation in v2 responses
2016-12-16 15:53:26 +00:00
minglis
9c161df2b6 Merge pull request #771 from alphagov/fix-missing-template-id
Fix for missing template IDs.
2016-12-16 14:41:54 +00:00
imdadahad
27952e96e0 Add comment for e.path schema validation fix
Add comment for e.path in schema validation and use popleft()
2016-12-16 12:41:19 +00:00
Rebecca Law
be9861c867 Merge pull request #769 from alphagov/add-log-to-ses-callback
Added logging when the SES callback is successful.
2016-12-16 11:58:43 +00:00
Rebecca Law
408048f478 Merge pull request #768 from alphagov/fix-status-type
Update the timeout notifications to use technical-failure
2016-12-16 11:50:48 +00:00
Rebecca Law
40dca7f9c7 Changed the timeout notications update query to set notifications still in created to a technical-failure and notifications still in sending or pending are set to a temporary-failure 2016-12-16 11:40:58 +00:00
Martyn Inglis
2924f01f95 Fix for missing template IDs.
- Problem was that on notification creation we pass the template ID not the template onto the new notification object
- We then set the history object from this notification object by copying all the fields. This is OK at this point.
- We then set the relationship on the history object based on the template, which we haven't passed in. We only passed the ID. This means that SQLAlchemy nulls the relationship, removing the template_id.
- Later we update the history row when we send the message, this fixes the data. BUT if we ever have a send error, then this never happens and the template is never set on the history table.

Fix:
Set only the template ID when creating the history object.
2016-12-15 16:59:03 +00:00
Rebecca Law
d70ae07499 Merge pull request #770 from alphagov/add-body-to-v2-response
Added boby and subject to the get_notifications schema
2016-12-15 16:45:05 +00:00
Imdad Ahad
243c4e481f Add uri validation to response schemas:
* Add to root uri and template.uri in responses
* Add tests to validate invalid or missing uri
* General refactoring for clarity
2016-12-15 16:39:15 +00:00
Imdad Ahad
7634c2e772 Add robustness to our v2 schema error messages:
* Ensure we dont raise exception if e.cause does not contain a message
* Ensure we handle case where e.path may be empty
* Refactor existing tests to conform to new format
2016-12-15 16:39:15 +00:00
Rebecca Law
db6db2e121 Renamed test, it was a duplicate name 2016-12-15 16:30:38 +00:00
Rebecca Law
7a623de171 Added boby and subject to the get_notifications schema 2016-12-15 16:19:55 +00:00
Rebecca Law
74a4651de2 Added logging when the SES callback is successful. 2016-12-15 10:34:29 +00:00
Chris Hill-Scott
2c9a3f6f57 Merge pull request #764 from alphagov/more-breaking-utils-changes
Update utils to 12.1.1
2016-12-14 17:46:15 +01:00
Rebecca Law
a6da1ac864 Update the timeout notifications to use technical-failure rather than temporary failure 2016-12-14 16:18:43 +00:00
Chris Hill-Scott
0cc94bc87b Include content count fix
Includes:
- [x] https://github.com/alphagov/notifications-utils/pull/102
2016-12-14 15:51:59 +00:00
imdadahad
f91a2b67f1 Merge pull request #767 from alphagov/fix-client-reference
Fix: Retrieve notifications by reference
2016-12-13 16:13:46 +00:00
Imdad Ahad
2481c35c85 Ensure non-matching-reference notifications are filtered out 2016-12-13 15:48:52 +00:00
Chris Hill-Scott
59af44d7ab Update utils to 12.0.0
Includes:

- [x] https://github.com/alphagov/notifications-utils/pull/94 (breaking
      changes which are responsible for all the changes to the API in
      this PR)

The test for `get_sms_fragment_count` has been removed because this
method is already tested in utils here:

ac20f7e99e/tests/test_base_template.py (L140-L159)
2016-12-13 10:57:01 +00:00
Imdad Ahad
e5496b29b8 Rename test 2016-12-12 18:13:44 +00:00
Imdad Ahad
52130e8ba4 Refactor tests 2016-12-12 18:06:14 +00:00
Imdad Ahad
431ec8acad Retrieve notifications by reference:
* Use get_notifications instead (references may not be unique)
2016-12-12 18:04:20 +00:00
Rebecca Law
4f9b295a5b Merge pull request #766 from alphagov/fix-sms-sender
Fix the from number in the post_sms_response.
2016-12-12 16:46:00 +00:00
imdadahad
551387251c Merge pull request #762 from alphagov/v2-get-notification-by-reference
V2 get notification by reference
2016-12-12 16:14:57 +00:00
Jenny Duckett
33e74a6b07 Merge pull request #765 from alphagov/use-notify-queue-to-deliver
Send Notify's 2FA codes via only one queue
2016-12-12 15:16:59 +00:00
Rebecca Law
9973d74d09 Fix the from number in the post_sms_response. If the service.sms_sender is not set the FROM_NUMBER from the config is returned, which is the default for the notification. 2016-12-12 15:07:03 +00:00
Rebecca Law
4ba580e77c Merge pull request #761 from alphagov/invite-expiry-msg
Invite expiry message
2016-12-12 15:06:26 +00:00
Jenny Duckett
7332874415 Use namedtuple in test_send_notification_to_queue
This makes this test a couple of seconds faster - 0.7s instead of 2.5s for me
locally. sample_notification also creates a service, template, user and
permissions, but we don't need any of these objects to exist in the database
for this test. It's particularly helpful for this test because there are so
many parameterized cases. Thanks @leohemsted for suggesting doing this here.
2016-12-09 17:37:18 +00:00
Jenny Duckett
e569c54f45 Send Notify's 2FA codes via only the notify queue
This means that these codes won't be delayed by large jobs going through the
send-sms/email queues. send_user_sms_code now works much more like the
endpoints for sending notifications, by persisting the notification and only
using the deliver_sms task (instead of using send_sms as well).

The workers consuming the `notify` queue should be able to handle the deliver
task as well, so no change should be needed to the celery workers to support
this.

I think there's also a change in behaviour here: previously, if the Notify
service was in research mode, 2FA codes would not have been sent out, making
it impossible to log into the admin. Now, a call to this endpoint will always
send out the notification even if we've put the Notify service into research
mode, since we set the notification's key type to normal and ignore the
service's research mode setting when sending the notification to the queue.
2016-12-09 16:46:49 +00:00
Jenny Duckett
d5d079a150 Add optional queue param to send_notification_to_queue
We want to use this function for sending internal notifications to a different
queue.
2016-12-09 16:46:49 +00:00
Rebecca Law
8c9e7b2d68 Update the tests for the new text 2016-12-09 12:28:28 +00:00
Pete Herlihy
e97c3bcc73 Tweaked the wording of the expired invitation message. 2016-12-09 12:20:03 +00:00
Imdad Ahad
620a90fd7c Make get_notifications return single notification by reference 2016-12-07 14:09:56 +00:00
Imdad Ahad
d4d733f997 Add dao method to get notification by reference with tests 2016-12-07 14:08:22 +00:00
Rebecca Law
eedc2fb43e Fix test and style 2016-12-07 13:29:19 +00:00
Rebecca Law
f946b022e8 Update the invitation expiry error message so that it is nicer to read. 2016-12-07 13:05:38 +00:00
minglis
32a21bfd3a Merge pull request #760 from alphagov/bumped-version-of-utils
Latest version of utils included
2016-12-07 09:15:15 +00:00
Martyn Inglis
869cf48eff Latest version 2016-12-06 16:51:46 +00:00
Jenny Duckett
f02869c1e6 Merge pull request #758 from alphagov/stats-toggle-test-key
Add include_from_test_key parameter to /service
2016-12-06 10:58:10 +00:00
minglis
f452bf46f0 Merge pull request #759 from alphagov/bumped-version
Bumped version
2016-12-06 09:57:50 +00:00
Chris Hill-Scott
1e4274655a Bump utils version to really bring in latest changes 2016-12-06 09:45:39 +00:00
minglis
aa2ac5e822 Merge pull request #756 from alphagov/use-redis-and-statsd-from-utils
Use redis and statsd from utils
2016-12-06 09:00:35 +00:00
Jenny Duckett
d2649aebc8 Add include_from_test_key parameter to /service
We want to be able to toggle the numbers on the platform admin page between
including and excluding notifications sent using test keys, so that we can see
both real use of the platform and all load on it.

This parameter defaults to True, which is the existing behaviour.
2016-12-05 17:50:52 +00:00
Jenny Duckett
7668745d8b Allow excluding test key use in the all services stats query 2016-12-05 17:35:19 +00:00
Jenny Duckett
ad7278fd4e Add tests for dao_fetch_todays_stats_for_all_services 2016-12-05 17:35:06 +00:00
bandesz
eda06228d6 Enable SSE for S3 upload 2016-12-05 16:58:20 +00:00
Martyn Inglis
3342ca2993 Bumped version 2016-12-02 16:56:23 +00:00
Martyn Inglis
085b40d367 Merge branch 'master' into use-redis-and-statsd-from-utils 2016-12-02 15:49:09 +00:00
Andras Ferencz-Szabo
2a2488e48c Merge pull request #757 from alphagov/docker_build_http_proxy
Set http proxy params for Docker build
2016-12-02 15:16:36 +00:00