Commit Graph

3636 Commits

Author SHA1 Message Date
kentsanggds
c110ca3f57 Merge pull request #1303 from alphagov/ken-purge-noti-to-email_reply_to
Purge notifications to email reply to rows older than 7 days
2017-10-13 15:23:58 +01:00
Richard Chapman
83585a4fdb Merge pull request #1304 from alphagov/ken-alert-missing-notis
Added alert when job.notification_count doesn't match total notification for job
2017-10-13 11:12:23 +01:00
Richard Chapman
b32b9bc344 Merge pull request #1308 from alphagov/pyup-update-flask-sqlalchemy-2.2-to-2.3.2
Update flask-sqlalchemy to 2.3.2
2017-10-13 09:27:33 +01:00
Richard Chapman
a3c8b5bbed Merge pull request #1310 from alphagov/rc_adding_logging_to_celery_tasks
Adding extra logging to celery tasks and gunicorn
2017-10-13 09:15:27 +01:00
Venus Bailey
2d5c87a185 Merge pull request #1300 from alphagov/pyup-update-sqlalchemy-utils-0.32.16-to-0.32.18
Update sqlalchemy-utils to 0.32.18
2017-10-12 17:32:22 +01:00
Rebecca Law
401e209856 Removed the new queue name as it is not needed. 2017-10-12 16:57:04 +01:00
Rebecca Law
fd2a7d3341 fix comment 2017-10-12 16:23:28 +01:00
Rebecca Law
e08690cad2 Added a new scheduled task that runs every minute, may want to run it every 3 minutes.
The tasks checks that a job is not still in progress 30 minutes after the job started processing.
2017-10-12 16:21:08 +01:00
Richard Chapman
83a8277b16 Fixed Typo in Log Message
After review, fixed a typo in the log message to make it consistent
 with other messages so it can be search for in logs and used in alerts.
2017-10-12 12:31:51 +01:00
Rebecca Law
c068c922b4 Merge branch 'master' into ken-alert-missing-notis 2017-10-12 11:48:54 +01:00
Richard Chapman
cc4d022213 Adding extra logging to celery tasks ans gunicorn, specifically log on SIGTERM and SIGINIT so that we can track better when an app restarts and why it restarts e.g. when it restarts after another signal. 2017-10-12 11:39:21 +01:00
Rebecca Law
fe37313d18 Merge pull request #1309 from alphagov/save-email-reply-to-for-one-off
Add email_reply_to_id for one off notifications
2017-10-12 10:53:38 +01:00
Rebecca Law
e23638ed78 Added a test for when the reply to email id does not exist 2017-10-12 09:34:37 +01:00
Ken Tsang
f9a7a78e55 Refactor code
- removed redundant dao method
- also handle letter jobs
2017-10-11 21:48:47 +01:00
Ken Tsang
c29fc8cfa4 Add celery task to check job finished
- celery task called after countdown of 60 minutes from start of job processing
2017-10-11 18:14:56 +01:00
Rebecca Law
769a7a275b Insert a row for the mapping of notification to email_reply_to for one off notifications. 2017-10-11 16:23:31 +01:00
pyup-bot
6050526711 Update flask-sqlalchemy from 2.2 to 2.3.2 2017-10-11 16:19:09 +01:00
Ken Tsang
92508d3b96 Create JobIncompleteError 2017-10-11 15:50:20 +01:00
Ken Tsang
1eaf6e089b Refactor code to make it clearer
- Added code in `delete_notifications_created_more_than_a_week_ago_by_type` to remove notifications to email_reply_to older than 7 days
- Added transactional to `delete_notifications_created_more_than_a_week_ago_by_type`
2017-10-11 12:26:58 +01:00
Ken Tsang
dcf0d22d7b Added alert when job.notification_count doesn't match total notification for job
- Added log for when a job starts so that we will know when the processing of a job starts with the number of notifications
- Added dao method to get total notifications for a job id
- Added a test to check whether the number of notifications in the table matches the job notification_count
2017-10-10 15:04:55 +01:00
Ken Tsang
b77a606699 Reorder imports 2017-10-09 15:12:50 +01:00
Ken Tsang
b7bc04f47b Removed redundant import 2017-10-09 15:02:15 +01:00
Richard Chapman
04914d711a Merge pull request #1301 from alphagov/rc_populate_reply_to_address
Task 4 - Allow API calls to specify the reply address option
2017-10-09 14:55:52 +01:00
Ken Tsang
2c46f201b5 Purge noti to email reply to older than 7 days 2017-10-09 14:51:27 +01:00
Richard Chapman
8c5771401a A few code style tweaks to adhere to standard for better maintainable code. 2017-10-06 17:08:06 +01:00
Richard Chapman
b311506f37 Updated send_to_providers.py to use the notification email_reply_to address if there is one present otherwise it uses the service email_reply_to so now users can choose a per notification email_reply_to address. 2017-10-06 16:58:32 +01:00
Richard Chapman
26d84a873e Merge pull request #1297 from alphagov/rc_persist_notification_email_reply_to_mapping
Task 3 - Allow API calls to specify the reply address option
2017-10-06 09:22:56 +01:00
Chris Hill-Scott
cf3cd6fb26 Merge pull request #1299 from alphagov/pyup-update-pytest-xdist-1.20.0-to-1.20.1
Update pytest-xdist to 1.20.1
2017-10-06 09:06:12 +01:00
pyup-bot
ad5a7afe54 Update sqlalchemy-utils from 0.32.16 to 0.32.18 2017-10-06 08:32:01 +01:00
pyup-bot
6a48381a4c Update pytest-xdist from 1.20.0 to 1.20.1 2017-10-05 21:35:58 +01:00
Richard Chapman
ce89a05038 Changes after review. Style changes to ensure consistency with the rest of the code base and changed the check of an asset message to be the full message to avoid any confusion in future. 2017-10-05 16:50:18 +01:00
Richard Chapman
068ecd80a1 Changes after review. Style changes to ensure consistency with the rest of the code base to ensure good maintainability in future. 2017-10-05 16:50:18 +01:00
Richard Chapman
7974e59eb7 Changes after review. Updates to style and import order to be more consistent with other code.
Added clarification to an error message to give better debugging information.
Removed using dao_get_reply_to_by_service_id in tests to be more consistent with other code and use the test db functions or remove the need for a call altogether making the code less complex.
2017-10-05 16:50:18 +01:00
Richard Chapman
d2168b7985 Added the mapping between notification and reply to email to the database and persisted the mapping when the request is received by the end point. the end point also checks if the reply to email id exists and if not returns an error. Also added tests to test the functionality. 2017-10-05 16:50:17 +01:00
Katie Smith
68d8999b1c Merge pull request #1294 from alphagov/add-new-letter-block-endpoints
Add new letter contact block endpoints (multiple addresses)
2017-10-05 15:58:51 +01:00
kentsanggds
4bd92a245b Merge pull request #1292 from alphagov/ken-update-ftp-scheduled-task-times
Update ftp tasks to send in the evening rather than the morning
2017-10-05 12:50:52 +01:00
Chris Hill-Scott
0f6111f6ed Merge pull request #1295 from alphagov/pyup-update-pytest-3.2.2-to-3.2.3
Update pytest to 3.2.3
2017-10-05 10:25:23 +01:00
pyup-bot
0f4a3ce8a6 Update pytest from 3.2.2 to 3.2.3 2017-10-04 22:18:02 +01:00
venusbb
5e2bf4cd32 Add new POST /<uuid:service_id>/letter-contact/<uuid:letter_contact_id> end point 2017-10-04 15:35:41 +01:00
Katie Smith
158e2ea181 Add endpoint to add new letter contact block
Added the '/<uuid:service_id>/letter-contact' service endpoint.
2017-10-04 15:31:45 +01:00
Rebecca Law
519c98615b Merge pull request #1288 from alphagov/return-service_sms_sender_value
Return service_sms_sender
2017-10-04 15:29:24 +01:00
Rebecca Law
9d507466ef Remove exception thrown when getting default sender.
Having more than one default is checked on insert and update.
2017-10-04 14:51:02 +01:00
Richard Chapman
2fbe492d5c [2/10] Allow API calls to specify the reply address option (#1291)
* Added service_email_reply_to_id to the POST /v2/notifications/email and a test to test the validator

* Caught NoResultFound exception in check_service_email_reply_to_id as it was not being caught when there there was no valid service_id or reply_to_id. Fixed failing tests which were not passing due to the NoResultFound exception and added further tests to check for the good path through the code and an test to check for an invalid service_id

* Added service_email_reply_to_id to the POST /v2/notifications/email and a test to test the validator

* Caught NoResultFound exception in check_service_email_reply_to_id as it was not being caught when there there was no valid service_id or reply_to_id. Fixed failing tests which were not passing due to the NoResultFound exception and added further tests to check for the good path through the code and an test to check for an invalid service_id

* Fixed code style in validators.py to confirm with rules
Update the name of email_reply_to_id to conform better with other attributes in the schema and the resultant code in post_notifications.py
Fixed code style in test_validators.py to confirm with rules
Added tests to test_post_notifications.py to test the email_reply_to_id being present and being incorrect, it being optional is being tested by other tests.

* Added service_email_reply_to_id to the POST /v2/notifications/email and a test to test the validator

* Added service_email_reply_to_id to the POST /v2/notifications/email and a test to test the validator

* Caught NoResultFound exception in check_service_email_reply_to_id as it was not being caught when there there was no valid service_id or reply_to_id. Fixed failing tests which were not passing due to the NoResultFound exception and added further tests to check for the good path through the code and an test to check for an invalid service_id

* Caught NoResultFound exception in check_service_email_reply_to_id as it was not being caught when there there was no valid service_id or reply_to_id. Fixed failing tests which were not passing due to the NoResultFound exception and added further tests to check for the good path through the code and an test to check for an invalid service_id

* Fixed code style in validators.py to confirm with rules
Update the name of email_reply_to_id to conform better with other attributes in the schema and the resultant code in post_notifications.py
Fixed code style in test_validators.py to confirm with rules
Added tests to test_post_notifications.py to test the email_reply_to_id being present and being incorrect, it being optional is being tested by other tests.

* Minor update after manual merge to fix check style rule break in test_validators.py where a single space was introduced.

* Updates after code review. Moved the template from the exception message as it was not required and updated the error message to match the field name in the sschema for better debugging and error identification.

* Fixed test after update of exception message
2017-10-04 14:34:45 +01:00
Rebecca Law
cefb74c732 Removed a test that should have been removed during the last merge 2017-10-04 13:49:01 +01:00
Rebecca Law
78a9d74c49 Merge branch 'master' into return-service_sms_sender_value 2017-10-04 13:29:05 +01:00
Sakis
517fec5e36 Merge pull request #1293 from alphagov/fix-cffi
Pin to a specific version of cffi
2017-10-04 12:34:39 +01:00
venusbb
212ce302c8 Add get letter contact by id endpoint
Added the GET /<uuid:service_id>/letter-contact/<uuid:letter_contact_id>
endpoint for returning a letter contact for a service with the letter contact id

Added the DAO for returning a letter contact by id
2017-10-04 12:26:38 +01:00
Athanasios Voutsadakis
80c2d85508 Instruct pyup to skip cffi==1.11.1 2017-10-04 12:20:21 +01:00
Katie Smith
1fa1ebb96f Add endpoint to return all letter contact blocks
Added the GET '/<uuid:service_id>/letter-contact' endpoint for returning
all letter contact blocks for a service.

Updated the DAO for service letter contacts to return the default letter
contact first.
2017-10-04 11:26:27 +01:00
Athanasios Voutsadakis
c362bd06b0 Pin to a specific version of cffi
Version 1.11.1 seems to be
[broken](https://bitbucket.org/cffi/cffi/issues?status=new&status=open)

It's pulled in because of [Flask-bcrypt](https://github.com/alphagov/notifications-api/blob/master/requirements.txt#L4)
which [depends on bcrypt](https://github.com/maxcountryman/flask-bcrypt/blob/master/setup.py#L33) which
[asks for a version of cffi >= 1.1](https://github.com/pyca/bcrypt/blob/master/setup.py#L12)
2017-10-04 10:58:22 +01:00