Commit Graph

696 Commits

Author SHA1 Message Date
Rebecca Law
f8262b13c1 Refactor permissions dao - removed custom query filter
Removed permissions rest - not being used.
2016-06-15 16:32:52 +01:00
Leo Hemsted
2b13033e85 add template body, version, and subject to send_notification api 2016-06-15 14:51:35 +01:00
Adam Shimali
b33312b855 Change endpoint responses where there are marshalling, unmarshalling
or param errors to raise invalid data exception. That will cause
those responses to be handled in by errors.py, which will log
the errors.

Set most of schemas to strict mode so that marshmallow will raise
exception rather than checking for errors in return tuple from load.

Added handler to errors.py for marshmallow validation errors.
2016-06-15 14:37:51 +01:00
Leo Hemsted
d0eca79417 move all send_notification tests to separate file 2016-06-15 12:27:57 +01:00
Rebecca Law
470bf7281a Merge pull request #420 from alphagov/use-notify-to-send-email-verification-links
Use notify to send email verification links
2016-06-14 17:00:28 +01:00
Rebecca Law
4c34238a88 Fix send_email task requested from notifications endpoint. 2016-06-14 16:53:52 +01:00
Rebecca Law
a55b44a333 Merge pull request #412 from alphagov/use-notify-to-send-email-verification-links
Safely change task signature - first deploy
2016-06-14 15:42:59 +01:00
Chris Hill-Scott
7f7743b389 Test for filtering a job by notification status
It’s going to be useful to see all the notifications for a job that are
failed/delivered/etc.

The API seems to support this behaviour already, but it doesn’t seem to
be tested.

This commit adds some testsfor the DAO and REST layers.
2016-06-14 14:07:54 +01:00
Martyn Inglis
0a933021d6 Merge branch 'master' into split-sms-and-retry 2016-06-14 12:55:16 +01:00
Martyn Inglis
f143aade71 Added new tests/code to ensure failure stats recorded 2016-06-13 16:40:46 +01:00
Rebecca Law
a6ce109c62 Rename first send_email to send_email_v1.
Fix the tests
2016-06-13 16:16:56 +01:00
Rebecca Law
cd2627e5ed Create a new task called send_email_v2 so that I can get rid of the from_address in the signature.
This is done to make sure we do not lose any messages in the queue during deployment.
2016-06-13 15:31:45 +01:00
Rebecca Law
5fc14940f3 Let the send_email task set the from address 2016-06-13 14:58:00 +01:00
Rebecca Law
c9f1eb65a7 Build the from address in the task instead of the rest call. 2016-06-13 14:57:59 +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
Rebecca Law
b677768de1 Merge pull request #400 from alphagov/remove-task-send-sms-code
Remove task send_sms_code.
2016-06-13 11:34:26 +01:00
Leo Hemsted
edc72a57ca add test file for schemas 2016-06-10 16:34:20 +01:00
Leo Hemsted
fd2a0a0b10 fix firetext research mode requests
requests converts dicts into query parameters anyway if you don't specify so dont try and encode the data ourselves, also hardened up tests
2016-06-09 15:15:44 +01:00
Rebecca Law
50ec2eb7fc Remove task send_sms_code.
We use a notify service to send the sms code via using a template.
2016-06-09 11:54:34 +01:00
Leo Hemsted
3e72440f38 fix template api tests being inconsistent by adding ordering 2016-06-09 11:24:04 +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
Nicholas Staples
8a1f4de217 Task added to update 'sending' notifications after 72 hours, set task to temporary-failure. 2016-06-08 15:25:57 +01:00
Adam Shimali
e28ef237e4 When adding a user new with permissions to a service, the permissions
dao was deleting all permissions for that user (regardless of service
id) as the last filter on the permissions dao get_query method won.

I've added a replace flag to the set_user_service_permission method
so that it can handle adding new users + permissions and editing
of existing users' permissions.

Also by pass the get_query method until it can be refactored to work
correctly.

For now execute the filter query directly on the model.
2016-06-07 16:35:26 +01:00
Leo Hemsted
e3d9dfad6e add template_statistics endpoint for specific template
`/service/<service_id>/template-statistics/<template_id>`
still requires service-id just to try and keep api tree cleaner
2016-06-07 14:18:42 +01:00
Martyn Inglis
b6fa6815ee Commented out tests in progress 2016-06-07 12:54:25 +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
Martyn Inglis
37fe2342ae Merge branch 'master' into split-sms-and-retry 2016-06-07 11:10:17 +01:00
Martyn Inglis
642aa2890e Starting to implement tests across the new tasks file 2016-06-07 11:09:54 +01:00
Adam Shimali
207d9088c4 Merge pull request #384 from alphagov/invite-permissions-fix
API receives full set of permission names
2016-06-07 09:36:32 +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
d3c85732bc Merge pull request #383 from alphagov/use-notify-to-send-sms-codes
Use notify to send sms codes
2016-06-06 14:30:25 +01:00
Adam Shimali
63c29a3a3d API recieves full set of permissions names on create of user
invite. This is instead of mapping from permission groups to individual
permissions on user creation.
2016-06-06 12:37:06 +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
Chris Hill-Scott
c2ae4773da Order templates by newest created first
When you add a new template, it’s probably the one that you want to do
subsequent stuff with. But it’s also helpful to see the template in
context (with its siblings) to understand that there are multiple
templates. So we don’t want to do what we do in
https://github.com/alphagov/notifications-admin/pull/648
for adding a new template.

But we _can_ make your brand-new template appear first by always
ordering by when the template was created.

This also removes the confusion caused by having `updated_at` affecting
order, and causing the templates to move around all the time.
2016-06-06 10:44:40 +01:00
Rebecca Law
dbc57e3b58 [WIP]
use send_sms task to send sms code.
Tests are broken because the template data for the Notify service is being delete after every test. Need a way to seed the data for the test.
2016-06-03 15:15:46 +01:00
Leo Hemsted
a487931323 python 34 compatibility 2016-06-02 16:49:34 +01:00
Leo Hemsted
54a1adfe8b fix copypasta error with ses test 2016-06-02 16:30:40 +01:00
Leo Hemsted
d41048f4aa statsd counters for callback statuses
also for the 'code' param from firetext
2016-06-02 15:53:04 +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
5e1613e461 pep8 too many lines 2016-06-02 10:35:54 +01:00
Rebecca Law
b2a26e3dce Merge pull request #361 from alphagov/do-not-create-new-tempalte-version
Check for an update before saving template
2016-06-02 10:11:55 +01:00
Martyn Inglis
c6c534365e Fixing tests as stats update now don't update reference 2016-06-02 10:00:27 +01:00
Martyn Inglis
754ccbe9af Removed update reference from updating the provider stats
- single focus method
- allows not to pollute DAO with research mode
2016-06-02 09:52:47 +01:00
Martyn Inglis
099c17192d Merged provider stats only on success branch
- ensures that don't raise stats in research mode
2016-06-02 09:30:01 +01:00
Martyn Inglis
001149c263 Merge branch 'master' into research-mode-implementation 2016-06-02 09:28:35 +01:00
Martyn Inglis
b08f906662 Added 2 tests to ensure provider stats not updated when in research nmode 2016-06-02 09:28:21 +01:00
Martyn Inglis
97e29b9039 Merge branch 'master' into research-mode-implementation 2016-06-01 17:06:38 +01:00