Commit Graph

719 Commits

Author SHA1 Message Date
imdadahad
6cbd5396ea Merge pull request #662 from alphagov/remove-send-notification-tests
Remove rate limiting tests
2016-09-07 15:18:44 +01:00
Imdad Ahad
41681ac001 Fix mocker syntax issue 2016-09-07 11:17:27 +01:00
Imdad Ahad
840b99b277 Fix issue where test key cannot send messages to external numbers 2016-09-07 09:57:20 +01:00
Martyn Inglis
259fb0cb62 Slightly changed to only unlimited the live services.
Logic:
- live services don't check days limit for now
- restricted services check limits
(caveat) simulate keys aren't checking day limit even in restricted mode.
2016-09-06 14:21:36 +01:00
Rebecca Law
727c00af21 Merge pull request #659 from alphagov/update-requirements
Update requirements
2016-09-06 14:16:31 +01:00
Chris Hill-Scott
be9fd96d03 Merge pull request #656 from alphagov/add-cancel-job-endpoint
Add an endpoint to cancel a job
2016-09-06 12:11:32 +01:00
Imdad Ahad
d6a8780515 Remove send notification test 2016-09-06 11:39:22 +01:00
Rebecca Law
4d1c34fcce A little bit of clean up.
- Remove the deploy to staging | live links in the README
- Update most of the outdated requirements. Left Flask update out for now.
2016-09-05 16:45:54 +01:00
minglis
64bb12c866 Merge pull request #640 from alphagov/scheduled-delivery-of-jobs-cleanup
Scheduled delivery of jobs cleanup
2016-09-05 12:29:10 +01:00
Leo Hemsted
6ceb80d32f Merge pull request #651 from alphagov/contract-tests
Contract tests
2016-09-05 11:31:29 +01:00
Chris Hill-Scott
e28ce50d17 Don’t pass notify_db or notify_db_session to test
They get set up by the `sample_scheduled_job` fixture.
2016-09-03 08:48:03 +01:00
Chris Hill-Scott
5d4e942fa1 Use fixture for testing scheduled jobs 2016-09-02 12:27:23 +01:00
Chris Hill-Scott
4a7267be8b Add an endpoint to cancel a job
If you schedule a job you might change your mind or circumstances might
change. So you need to be able to cancel it. This commit adds a `POST`
endpoint for individual jobs which sets their status to `cancelled`.

This also means adding a new status of `cancelled`, so there’s a
migration…
2016-09-02 12:27:02 +01:00
Rebecca Law
e3fa8bffd7 Fix merge conflicts in tests.
Update new migrations scripts to fix conflict in with script names.
2016-09-02 12:01:38 +01:00
Rebecca Law
8f3e8181fe Merge branch 'master' into scheduled-delivery-of-jobs-cleanup
Conflicts:
	tests/app/job/test_rest.py
2016-09-02 11:03:21 +01:00
Rebecca Law
3d41fa9634 Update mmg status code 2 to be a permanent failure. 2016-09-01 10:23:37 +01:00
Leo Hemsted
95e3f39c6f Merge pull request #632 from alphagov/readme-cleanup
cleaned up readme + environment file
2016-08-31 17:08:49 +01:00
minglis
c09fa34edf Merge pull request #650 from alphagov/add-statistics-to-job
Return empty stats list for job creation
2016-08-31 16:25:25 +01:00
Leo Hemsted
5ac4e630d8 remove some legacy code/tests relating to old invite/verification code 2016-08-31 14:49:26 +01:00
Chris Hill-Scott
e98a740dbf Fix test to expect correct db queue
Sending emails was moved to a different queue in:
https://github.com/alphagov/notifications-api/pull/647

At the time that
https://github.com/alphagov/notifications-api/pull/645
was written, the previous queues were still being used.

So when #645 got merged it was testing for the old queues, which broke
the tests.
2016-08-31 13:46:00 +01:00
Chris Hill-Scott
f3495f9dae Merge pull request #645 from alphagov/no-restrictions-on-test-key
Remove restrictions when using simulate API key
2016-08-31 13:25:12 +01:00
Leo Hemsted
7240df0641 replace mock with unittest.mock 2016-08-31 12:39:11 +01:00
Leo Hemsted
c91358673f add POST response tests
assert that the response for emails and sms is formatted as expected

also moved schemas into subdirectory to make folder more legible
2016-08-31 12:33:45 +01:00
Martyn Inglis
57267a36f2 Return empty stats list for job creation 2016-08-31 12:12:09 +01:00
Leo Hemsted
fabbb8b01b separate tests for api and job notifications 2016-08-31 11:53:54 +01:00
Martyn Inglis
6488feaeec Remove the status column from jobs, and update the new job status column with the previous values 2016-08-31 10:23:34 +01:00
Leo Hemsted
cb0491cbff add test for GET /notification
simple schema with oneOf [email, sms].
also fixed error where ref'd schemas weren't being picked up
2016-08-30 19:07:46 +01:00
Leo Hemsted
1b7b4a2ccb separate definitions into separate files to allow reuse
see https://github.com/Julian/jsonschema/issues/98

took boring generic things (eg uuid) into definitions.json, and also
separated email and sms notification objects into respective files
2016-08-30 18:45:54 +01:00
Martyn Inglis
e640e048e5 Pushed the notifications from the CSV in the DB queue 2016-08-30 17:27:01 +01:00
Leo Hemsted
aebaea1072 add public contract tests
use jsonschema to test the GET /notification/{} endpoint to highlight any key name/format/type changes
2016-08-30 15:55:52 +01:00
Leo Hemsted
b21c8de9a3 add new sample_email_notification fixture
dont include any of the parameters for now - only add em when we have an actual need for them
2016-08-30 15:55:27 +01:00
Leo Hemsted
59346d7546 add new client fixture
replaces previous notify_api fixture with the age old:
```
    with notify_api.test_request_context():
        with notify_api.test_client() as client:
```

just runs those two context managers in a yield fixture (new pytest 3.0 feature)
2016-08-30 15:55:27 +01:00
Leo Hemsted
fa3d4413e7 update test requirements
requirements should be kept up to date to ensure we get bug fixes and new features as they come - particularly py.test, which we were running an 18 month old version for, and missing out on some useful xfail and fixture enhancements, among other things
2016-08-30 15:55:23 +01:00
Martyn Inglis
f3c614634f Merge branch 'master' into seperate-queues-for-sending-and-for-db 2016-08-30 14:25:14 +01:00
minglis
4a078e3c61 Merge pull request #635 from alphagov/scheduled-delivery-of-jobs
Scheduled delivery of jobs
2016-08-30 12:48:48 +01:00
Martyn Inglis
b923392c49 Using UTC dates on API validation for scheduled jobs. 2016-08-30 12:47:33 +01:00
Chris Hill-Scott
7769923dda Allow test key to send irrespective of daily limit
When you use a simulate API key it should behave like a live service,
except for actually sending the messages. There should be no limits even
if the service is in trial mode.

This commit removes the restriction on sending messages when you’ve sent
up to your daily limit.
2016-08-30 11:06:38 +01:00
Chris Hill-Scott
5eaec8c235 Allow test key to send irrespective of trial mode
When you use a simulate API key it should behave like a live service,
except for actually sending the messages. There should be no limits even
if the service is in trial mode.

This commit removes the restriction on sending messages to peole outside
your team when you’re in trial mode.
2016-08-30 11:06:15 +01:00
minglis
5c8c2eb039 Merge pull request #641 from alphagov/add-job-stats-to-get-all-jobs-query
Bug fix:
2016-08-30 11:00:16 +01:00
Martyn Inglis
486697d07c New queues for the sms/email tasks
Previously there were 4 queues for sending messages

The was based on the fact that each notification has 2 actions - persist in the database and send to provider.

Two queues supported the CSV upload - for the first of these tasks
- bulk-email
- build-sms

And there were two more queues for the tasks that make the 3rd party client calls.
- sms
- email

API Calls just used the latter two queues for both tasks

Added four new queues
- db-email
- db-sms
- send-sms
- send-email

So an API call puts a notification into the db-[type] queue first, which then puts the notification into the send-[type] queue

Build queues stay as before.

This will allow us to target processing of these tasks with separate workers to manage these differently.
2016-08-30 10:42:24 +01:00
Leo Hemsted
4f0c5fdd9e Merge pull request #623 from alphagov/test-fixes
Test fixes
2016-08-30 10:38:53 +01:00
minglis
287d32c037 Merge pull request #638 from alphagov/remove-contested-writes
Remove contested writes
2016-08-30 08:56:45 +01:00
Martyn Inglis
e1543e9a5c More definite create times on job - some intermittent test fails where ordering ambiguous. 2016-08-26 15:32:46 +01:00
Martyn Inglis
dd7850b235 Bug fix:
- Get all jobs for service doesn't return the statistics.
- Dashboard therefore is incorrect

This is the API fix for this, returns the data.
2016-08-26 15:07:59 +01:00
Chris Hill-Scott
f09704e5f4 Merge pull request #624 from alphagov/sms-sender-no-prefix
Don’t prefix text messages if sender name is set
2016-08-26 14:57:12 +01:00
Chris Hill-Scott
f7391da350 Don’t prefix text messages is sender name is set
Implements:
- [x] https://github.com/alphagov/notifications-utils/pull/66
2016-08-26 14:45:01 +01:00
Leo Hemsted
7835339165 Merge branch 'master' into test-fixes 2016-08-26 10:57:41 +01:00
Martyn Inglis
8b9319ac7a Merge branch 'master' into scheduled-delivery-of-jobs
Conflicts:
	app/dao/jobs_dao.py
	tests/app/dao/test_jobs_dao.py
	tests/app/job/test_rest.py
2016-08-25 14:53:00 +01:00
Martyn Inglis
05abd15026 Merge branch 'master' into remove-contested-writes 2016-08-25 14:38:04 +01:00
Martyn Inglis
5012d20d58 Merge branch 'master' into remove-contested-writes 2016-08-25 14:37:51 +01:00