Commit Graph

1435 Commits

Author SHA1 Message Date
Chris Hill-Scott
1bf37888dd Fix mis-matched database migrations
The cancelled job migration originally went in as version `0051`.

But `0051_set_job_status` went in first in
e3fa8bffd7

This meant that Alembic couldn’t work out what order to run the
migrations in, and blew up.

This commit puts the scheduled job migration after all others.
2016-09-06 13:07:20 +01:00
Chris Hill-Scott
9318eec3a5 Merge pull request #661 from alphagov/update-requirements-1
Update requirements
2016-09-06 12:12:52 +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
Chris Hill-Scott
3b6905b98d Update requirements
Brings in:
- [x] https://github.com/alphagov/notifications-utils/pull/67
2016-09-06 10:53:34 +01:00
minglis
1d5db00b87 Merge pull request #657 from alphagov/drop-model-before-column
Changed 0052 to not drop the column, rather set it to allow nulls.
2016-09-05 14:46:46 +01:00
Martyn Inglis
22844d1bf2 Changed 0052 to not drop the column, rather set it to allow nulls.
This allows existing code to run.
2016-09-05 13:22:45 +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
2aa8baec63 Make indentation consistent 2016-09-02 23:22:15 +01:00
Chris Hill-Scott
2c17825c12 Don’t use magic string for job status 2016-09-02 23:22:14 +01:00
Chris Hill-Scott
5d4e942fa1 Use fixture for testing scheduled jobs 2016-09-02 12:27:23 +01:00
Chris Hill-Scott
11a4b18451 Combine query filters when getting scheduled job
> filter_by and filter are just aliases for each other so can be
> combined together - filter is probably the better one (and then use
> == instead of keyword args)
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
aa8ee3a8da Merge pull request #655 from alphagov/mmg-update-status
Update MMG status code 2 to be a permanent failure.
2016-09-02 09:44:24 +01:00
Leo Hemsted
b294568a91 Merge pull request #653 from alphagov/junit-test-results
add junit xml reporting to pytest
2016-09-02 09:38:01 +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
f94e8d3cf0 Merge pull request #654 from alphagov/index-slow-queries
Indexes to improves stats for service query
2016-08-31 16:31:05 +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
minglis
6405cb74c7 Merge pull request #649 from alphagov/queues-for-production
Queues for production
2016-08-31 16:25:13 +01:00
Martyn Inglis
ab5ff64dd0 Indexes to improves stats for service query 2016-08-31 16:24:18 +01:00
Leo Hemsted
00cac0f88b add junit xml reporting to pytest
also add file location to gitignore preemptively
2016-08-31 15:03:28 +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
c0247d93c8 Merge pull request #652 from alphagov/db-queues-changed
Fix test to expect correct db queue
2016-08-31 13:56:16 +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
f2309e041b Merge pull request #648 from alphagov/quis-patch-1
Remove outdated comment
2016-08-31 13:25:18 +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
Martyn Inglis
6858641a3c Debug mode on for tests. 2016-08-31 12:09:12 +01:00
Leo Hemsted
fabbb8b01b separate tests for api and job notifications 2016-08-31 11:53:54 +01:00
Martyn Inglis
06cb440fd2 Not a function call. 2016-08-31 11:42:05 +01:00
Martyn Inglis
ce006bd92d Start/Stop the new worker scripts on the code deploy actions. 2016-08-31 11:40:47 +01:00
Martyn Inglis
c108c493e6 Rejigged the queue config.
- the two new queues that handle delivery of notifications (db-[type] / send-[type]) Now no longer are processed by the default workers
- These workers now to the admin type queues for notify (CSV/Validation codes) etc.
- Two new workers are deployed to the AWS environments, one focused on db- tasks and one for send tasks
- These will pick up those queues explicitly.
2016-08-31 11:40:31 +01:00
minglis
bcfa83de79 Merge pull request #647 from alphagov/move-csv-emails-into-same-queue-as-api
Pushed the notifications from the CSV in the DB queue
2016-08-31 10:41:27 +01:00
Chris Hill-Scott
316e4b9ea6 Remove outdated comment
Added in January[1] and (for better or worse) it got done.

1. 49e98c21e7)
2016-08-31 10:39:25 +01:00
Martyn Inglis
489f95c8cd Fixed the downgrade script 2016-08-31 10:23:34 +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
Andras Ferencz-Szabo
668e6c9716 Merge pull request #646 from alphagov/jenkins_coveralls
Finish coveralls task
2016-08-30 14:44:01 +01:00