Commit Graph

131 Commits

Author SHA1 Message Date
minglis
d67e43a6d0 Merge pull request #583 from alphagov/stats-db-updates
Stats db updates
2016-08-08 11:48:01 +01:00
Leo Hemsted
527a5c4eaa calculate billable units when sending an sms
don't calculate it if we're in research mode
* added tests to prove this
* removed last code referring to content_char_count
2016-08-03 16:46:05 +01:00
Martyn Inglis
e6347d99bd Merge branch 'master' into stats-db-updates
Conflicts:
	tests/app/conftest.py
2016-08-03 11:46:40 +01:00
Martyn Inglis
61aaa36f9b Rewiring how we do statsd
- decorater added to the DAO for notifications
2016-08-02 14:23:47 +01:00
Leo Hemsted
444132ad66 rewrite weekly aggregate function to honor week boundaries
(and not use the stats table, and also be easier to read)
2016-07-26 17:23:59 +01:00
Leo Hemsted
fd96c854e1 add dao function to get notification stats for a server for toady only 2016-07-26 14:35:29 +01:00
Leo Hemsted
3b552139ce add tests for dao 2016-07-21 14:04:25 +01:00
Rebecca Law
c8ad5362eb Moved mmg_url to configs.
Fix up the tests
2016-07-20 10:40:50 +01:00
Rebecca Law
b2da3f563b Merge branch 'master' into email-registered-users 2016-07-08 14:53:38 +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
Rebecca Law
36ecdca04c Add new email template for the GOV.UK Notify service, to send an email to users that register with the same email address.
Add a new endpoint to send the email.
2016-07-07 17:23:07 +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
Rebecca Law
60e159e3c0 Add notification_type to notification table.
It seems like an oversight not to include the notification type in the notifcation.
When updating statistics a query to the template table is required to get the type, this update will mean that query does not have to happen.
2016-06-29 11:23:02 +01:00
Rebecca Law
6626771335 Merge branch 'master' into notification-created-status 2016-06-27 15:36:42 +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
Leo Hemsted
e9482c7fe1 add new key_type table
* single-column static data table that currently contains two types: 'normal' and 'team'
* key_type foreign-keyed from api_keys
  - must be not null
  - existing rows set to 'normal'
* key_type foreign-keyed from notifications
  - nullable
  - existing rows set to null
* api_key foreign-keyed from notifications
  - nullable
  - existing rows set to null
2016-06-24 15:56:54 +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
Martyn Inglis
838bf1d7d4 Merge branch 'master' into split-sms-and-retry
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
2016-06-17 16:39:03 +01:00
Rebecca Law
b6c6b25032 Use the send email task to send the password reset and invitation email.
Next PR can remove those tasks.
2016-06-16 17:34:33 +01:00
Martyn Inglis
0a933021d6 Merge branch 'master' into split-sms-and-retry 2016-06-14 12:55:16 +01:00
Rebecca Law
cfd31541f4 Use notify to send email verification 2016-06-13 14:57:41 +01:00
Martyn Inglis
bec882ba41 Merge branch 'master' into split-sms-and-retry 2016-06-13 11:39:13 +01:00
Martyn Inglis
6b5b40b953 Added tests for statsd and provider stats outcomes with the new provider stats tasks
- note large change to DAO to remove provider from create notification. Added on send now not creation.
2016-06-13 11:38:25 +01:00
NIcholas Staples
964fd5ac35 Merge pull request #377 from alphagov/single_from_number
Replaced mmg from number and firetext from number with single from nu…
2016-06-09 10:41:39 +01:00
Martyn Inglis
92e4c0872b Pulled out the tests that send SMSs into provider_tasks file/tests
- updated tests to validate creation of next task, not sending direct to provider
2016-06-07 12:53:31 +01:00
Nicholas Staples
fe7d894420 Replaced mmg from number and firetext from number with single from number.
Fix merge mistake.

Fix tests from merge.

Update config to include correct staging and live names.
2016-06-06 16:41:33 +01:00
Rebecca Law
be9fde1420 Fix tests for sending sms codes.
Since the unit tests delete the data in between tests I need to add the template data for the test for send sms code.
2016-06-06 11:51:12 +01:00
Martyn Inglis
b8638a891f Merge branch 'master' into research-mode-implementation
Conflicts:
	tests/app/conftest.py
2016-06-02 11:53:06 +01:00
Leo Hemsted
a51d6fae47 Merge pull request #363 from alphagov/send-sms-tests
send_sms tests
2016-06-02 11:27:57 +01:00
Martyn Inglis
001149c263 Merge branch 'master' into research-mode-implementation 2016-06-02 09:28:35 +01:00
Leo Hemsted
a3b847bf64 tests for send_sms through mmg/firetext 2016-06-01 15:59:44 +01:00
Nicholas Staples
276ca15919 Provider stats only updated if the provider successfully sends the message. 2016-06-01 12:43:26 +01:00
Martyn Inglis
909fac3c05 Added research mode tasks
- if a service is in research mode the don't send the notifications via the providers (MMG/SES/etc)
- instead set up a task to mimic those services callbacks - this completes the loop, and show stats, delivery receipts and so on.
- Use the "to" field to choose the response, allows users to create successful and errored notifications

temp fail sms, uses  "07833333333"
perm fail sms, uses = "07822222222"
success = "07811111111" (or anything else)

success email = "delivered@simulator.notify"
perm fail = "perm-fail@simulator.notify"
temp fail = "temp-fail@simulator.notify"
2016-05-31 16:55:26 +01:00
Rebecca Law
e4eecb894a Update job.notifications_delivered and job.notifications_failed count when updating the status of a notification. 2016-05-24 11:31:44 +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
Rebecca Law
917110870d Use the template version at the time the notification is created or at the time the job is created.
Update notifications/sms|email endpoint to send the template version to the queue.
Update the process_job celery talk to send the template version to the queue.
When the send_sms|send_email task runs it will get the template by id and version.

Created a data migration script to add the template_vesion column for jobs and notifications.
The existing jobs and notifications are given the template_version of the current template.
There is a chance this is the wrong template version, but deemed okay since the application is not live.

Create unit test for the dao_get_template_versions method.
Rename /template/<id>/version to /template/<id>/versions which returns all versions for that template id and service id.
2016-05-13 16:25:05 +01:00
Rebecca Law
c8c0f95dd2 Merge branch 'master' into add-template-version
Conflicts:
	tests/app/dao/test_notification_dao.py
2016-05-12 09:49:35 +01:00
Rebecca Law
f72f5aba05 [WIP]
Start to add template_version to jobs and notification
2016-05-11 17:04:51 +01:00
Martyn Inglis
8669a169eb Merge branch 'master' into primary-provider
Conflicts:
	app/dao/notifications_dao.py
	app/dao/provider_statistics_dao.py
	app/schemas.py
	tests/app/conftest.py
2016-05-10 09:13:02 +01:00
NIcholas Staples
f06aaa924e Merge pull request #287 from alphagov/statistics_group_by_week_backup
Group by Notification Statistics added and all tests working.
2016-05-09 10:17:37 +01:00
Nicholas Staples
d40d9f76d4 Purge functional tests command added with passing test.
Code quality fix.
2016-05-06 11:16:30 +01:00
Martyn Inglis
57e05feafb Updated the Provider stats and rates DAO objects to query based on the identifier in the ProviderDetails object.
- updated all tests
- changed teardown to leave provider details rows on end of individual tests
2016-05-06 09:09:47 +01:00
Nicholas Staples
f465066a69 Group by Notification Statistics added and all tests working.
Fixed tests for upgraded client.
2016-05-05 11:04:20 +01:00
Nicholas Staples
bedc20d0ff Fragment count endpoint added and all tests working. 2016-04-28 12:01:57 +01:00
Rebecca Law
94aab20317 Add created_by_id to jobs table.
The user logged in will be the user marked as creating the job.
The admin code already sends the created_by user when creating a job.
2016-04-26 16:15:34 +01:00
Nicholas Staples
e6cc3b1724 Added functionality to archive a template.
Renamed migration file.
2016-04-26 10:11:18 +01:00
Chris Hill-Scott
eeaeacbf0b Remove send email code task
We don’t send email codes any more
2016-04-26 08:55:09 +01:00
Nicholas Staples
b56e324a4c Working tests and provider stats table.
Fix for tests and import error.

Added tests and updated for code review comments.
2016-04-25 12:20:06 +01:00