Commit Graph

1393 Commits

Author SHA1 Message Date
minglis
da6a6f6641 Merge pull request #959 from alphagov/comma-format-message-limit
Comma-format number when emailing live services
2017-05-18 11:06:24 +01:00
Martyn Inglis
8dc7a86148 Merge branch 'master' into async-job-stats
Conflicts:
	app/dao/services_dao.py
2017-05-18 09:34:54 +01:00
Ken Tsang
e68c3900e8 Add restricted argument for service mock 2017-05-17 16:06:35 +01:00
Ken Tsang
edff192efc Remove whitespace 2017-05-17 14:18:12 +01:00
Ken Tsang
54446d5f4d Add default permissions when creating a service 2017-05-17 14:18:12 +01:00
minglis
05a179c6ef Merge pull request #941 from alphagov/load-service-on-auth
Load service on auth
2017-05-17 10:49:00 +01:00
Martyn Inglis
83a1b1526e Merge branch 'master' into async-job-stats
Conflicts:
	app/notifications/notifications_ses_callback.py
2017-05-17 09:49:43 +01:00
kentsanggds
c4964d8cf4 Merge pull request #956 from alphagov/add-service-permissions
Add service permissions DAO and refactor user service permission mock
2017-05-16 14:26:15 +01:00
Ken Tsang
3602431c2a Renamed test and refactored fixtures 2017-05-16 13:41:54 +01:00
Ken Tsang
2a48891025 Removed unused pytest from test 2017-05-16 12:54:32 +01:00
Ken Tsang
b233ae46f3 Tidy up test code for service permissions 2017-05-16 12:53:46 +01:00
Martyn Inglis
a5dae0bebd Fixed test - I had deliberately failed the test as part of debugging and not fixed the assert. Doh. 2017-05-16 12:49:20 +01:00
Ken Tsang
733c16b2bb Update to strip down DAO and clarify tests 2017-05-16 12:33:27 +01:00
Chris Hill-Scott
2d4f10bd22 Comma-format number when emailing live services
250,000 is easier to read than 250000.
2017-05-16 12:33:01 +01:00
Martyn Inglis
d1aff5bb6e Complex test to check updating one type of notification job, doesn't update the other
- so if we timeout both SMS and Email the counts are correct
2017-05-16 11:36:52 +01:00
Ken Tsang
54d801979c Refactored to handle single service permission 2017-05-16 10:57:57 +01:00
Imdad Ahad
e6db9ffc1b Force parse JSON received from SNS:
* An SNS callback containing JSON has a plaintext header set. Using
* request.get_json() will return None if the header is not
* application/json unless the force parameter is set to True
2017-05-16 10:29:27 +01:00
Imdad Ahad
98aeb9f9da Merge pull request #951 from alphagov/imdad-feat-auto-send-email-live-service
Send a welcome email to newly live services
2017-05-15 17:39:38 +01:00
Ken Tsang
114d4d84d4 Add service permissions DAO and refactor user service permission mock 2017-05-15 17:28:14 +01:00
Imdad Ahad
aa5f8ba443 Refactor tests for clarity 2017-05-15 15:02:16 +01:00
Imdad Ahad
d993e1a43e Don't send notification if other service attrs changed 2017-05-15 15:02:01 +01:00
Imdad Ahad
4003edfa67 Add DVLA callback:
* Process SNS callback, trigger the update notifications celery task
* Put autoconfirm into its own method and use in callbacks
2017-05-15 11:12:31 +01:00
Imdad Ahad
ee484ec368 Add get_s3_file method for use in DVLA processing 2017-05-15 10:48:37 +01:00
Imdad Ahad
7a10a91262 Revert "Process SNS request triggered by a DVLA S3 update" 2017-05-12 17:21:07 +01:00
Martyn Inglis
fd542024a3 Merge branch 'master' into load-service-on-auth 2017-05-12 16:14:44 +01:00
Martyn Inglis
f4020aec05 these three tests replicate some testing that is done in the client tests themselves. 2017-05-12 16:10:21 +01:00
Imdad Ahad
0f7093fc38 Refactor and add filename in logging 2017-05-12 14:32:01 +01:00
Imdad Ahad
37165e5b6a Add autoconfirm sns in dvla callback 2017-05-12 14:24:27 +01:00
Imdad Ahad
8a5e82904e Update to pull from correct bucket and fix tests not mocking out correctly 2017-05-12 14:24:26 +01:00
Imdad Ahad
20bb91bfdd Update DVLA callback to process request and call task (if it can) 2017-05-12 14:24:26 +01:00
Imdad Ahad
f766f90207 Add task to process a DVLA response file:
* Currently we do nothing with the parsed response. We will
* update the status of the notifications in a separate PR
2017-05-12 14:24:26 +01:00
Imdad Ahad
5eb02a45a5 Send go live email when service goes live 2017-05-12 14:07:06 +01:00
Imdad Ahad
570d0ec9db Send notification to active service users with user fields (optional) 2017-05-12 14:06:29 +01:00
Martyn Inglis
4751673f43 Fixed service test that deletes all the things to delete the job stats too. 2017-05-12 13:08:09 +01:00
Martyn Inglis
1a61f06f53 Removed test as no longer make distinction on status. 2017-05-12 12:21:36 +01:00
Martyn Inglis
f84694fb29 updated the timeout query to base outcome on notifications
Previous:
assumed discrepancy in stats counts to be related to timeouts

Now:
If discrepancy exists do the math on the notifications for that job to work out counts based on statuses to redo stats.
2017-05-12 12:19:27 +01:00
Martyn Inglis
8d4ccc3003 Updated jobs_Dao to make a job stats row when making a job - saves the ambiguity later as to whether the row exists. 2017-05-12 12:17:34 +01:00
Martyn Inglis
d324d72926 Merge branch 'master' into async-job-stats 2017-05-11 15:41:20 +01:00
Imdad Ahad
048861b968 Add dao to get active users for service 2017-05-11 15:39:15 +01:00
Martyn Inglis
8818bd5dba Scheduled task to call the timeout function 2017-05-11 15:22:57 +01:00
Martyn Inglis
b519321798 Adds a query to timeout the job counts.
After three days we timeout the notifications that we have not received a receipt for.

In the same way we bump the failed count to match the job count if there is a descepenecy. We do this after the same period that we do for notifications.
2017-05-11 15:22:43 +01:00
Leo Hemsted
4d0b90bbe2 Merge pull request #943 from alphagov/schema-validation
fix v2 schema phone/email validation when non-str passed in
2017-05-11 14:42:22 +01:00
Martyn Inglis
76494a285e New logic to:
- increment sent only if the notifications is in a NON-finished state
- Increment outcome only if notification is in a finished state
2017-05-11 12:10:46 +01:00
Martyn Inglis
22a47106af Refactored the DAO to be clearer, and wrote tests for the bug whereby different types of inserts/updates caused others to reset. 2017-05-11 12:09:57 +01:00
Leo Hemsted
466c833c39 marshmallow schemas no longer return _status_enum column
now return `status`, as they should
2017-05-10 17:30:09 +01:00
Leo Hemsted
348183d93b Merge pull request #942 from alphagov/status-as-table
notification status as table
2017-05-10 13:54:49 +01:00
Leo Hemsted
5ec4829d00 fix v2 schema phone/email validation when non-str passed in
jsonschema states:

> A format attribute can generally only validate a given set of
> instance types. If the type of the instance to validate is not in
> this set, validation for this format attribute and instance SHOULD
> succeed.

We were not checking for the type of the input, and our validators were
behaving in unexpected manners (throwing TypeErrors etc etc). Despite
us declaring that the phone_number field is of type `str`, we still
need to make sure the validator passes gracefully, so that the inbuilt
type check can be the bit that catches if someone passes in a non-str
value. We've seen this with people passing in integers instead of strs
for phone numbers. This'll make them receive a nice 400 error
(e.g. "phone_number 12345 is not of type string"), rather than us
having a 500 internal server error
2017-05-10 11:04:12 +01:00
Martyn Inglis
19c14982a2 Call the task wrapper outcome function in the statistics_tasks file. This wraps the logic around which tasks to creates and simplifies the logic in the Callback classes. 2017-05-09 22:03:57 +01:00
Martyn Inglis
a4549a2e26 Put the statistics tasks into a new queue. This currently has no worker in PaaS so blocks the deployment until new PaaS worker is configured. 2017-05-09 22:03:13 +01:00
Martyn Inglis
caed193647 Use the new task wrapper methods rather than creating a task directly 2017-05-09 18:17:55 +01:00