Commit Graph

4119 Commits

Author SHA1 Message Date
Leo Hemsted
4e741bab90 Merge pull request #1441 from alphagov/flake8-tests
Flake8 tests
2017-11-29 16:54:29 +00:00
Rebecca Law
b6c348bc99 Merge pull request #1444 from alphagov/revert-config-change
Remove SQLALCHEMY_ECHO for test
2017-11-29 16:46:40 +00:00
Rebecca Law
3b1112d4e4 Remove SQLALCHEMY_ECHO for test 2017-11-29 15:15:03 +00:00
Rebecca Law
95fd1e8c31 Merge pull request #1434 from alphagov/pyup-update-pytest-3.2.5-to-3.3.0
Update pytest to 3.3.0
2017-11-29 14:52:53 +00:00
Rebecca Law
d3017da94a Merge pull request #1438 from alphagov/use-reply-to-in-send-to-provider
Use reply to in send to provider
2017-11-29 14:52:26 +00:00
Rebecca Law
fbcf777884 Remove unused import 2017-11-29 14:38:38 +00:00
Rebecca Law
ac6d041d26 Merge branch 'master' into use-reply-to-in-send-to-provider 2017-11-29 14:34:28 +00:00
Rebecca Law
39950c47bc Remove \t 2017-11-29 14:30:02 +00:00
Richard Chapman
c14b396deb Merge pull request #1443 from alphagov/rc_increase_gunicorn_threads
Increased Gunicorn threads
2017-11-29 14:25:18 +00:00
Richard Chapman
349887178c Increased Gunicorn threads
Increased Gunicorn threads to 10 on staging to test if there is a
performance increase when testing request per second. Increased to 10.
Gunicorn recommend 2 x cores + 1 however on PaaS the number of cores
is not consistent.
2017-11-29 14:13:26 +00:00
Venus Bailey
795056bc1b Merge pull request #1440 from alphagov/vb-govuk-db-migration
Migration to create new database table service_callback_api
2017-11-29 11:46:51 +00:00
Leo Hemsted
82acec87b6 flake8 the entire repo now that the tests are good 👌 2017-11-28 17:29:43 +00:00
Leo Hemsted
08494ef206 more flake8. lots of unused imports and variables that didn't get used. i tried to preserve old variable names as comments when it looked like they were useful (eg when they were describing timestamps) 2017-11-28 17:23:09 +00:00
Leo Hemsted
b1cccdcc6b First batch of flake8 changes.
Many unused variables, and replacing some old fixtures with
admin_request before I realised just how many there where 😩
2017-11-28 17:00:01 +00:00
Leo Hemsted
6ff9b8526a Merge branch 'master' into pyup-update-pytest-3.2.5-to-3.3.0 2017-11-28 15:33:47 +00:00
Leo Hemsted
363105774f Merge pull request #1439 from alphagov/flake8
Flake8
2017-11-28 15:33:07 +00:00
venusbb
5761d22822 Migration to create new database table service_callback_api 2017-11-28 15:25:15 +00:00
Leo Hemsted
90e9a2f1b3 use flake8 instead of pycodestyle
since there are thousands and thousands of errors in the tests files
at the moment, i propose fixing those errors in separate PR for now.
2017-11-28 14:28:01 +00:00
Leo Hemsted
28088428f1 flake8 - misc flake8 errs.
* unused variables
* variables in loops overshadowing imports
* excepts with no defined exc type (tried to avoid `except Exception` too)
* history mapper is still too complex
* default variables should never be mutable
2017-11-28 14:28:01 +00:00
Leo Hemsted
28d5f9b87f flake8 - remove unused imports and ensure they're always at the top of the file 2017-11-28 14:28:01 +00:00
Leo Hemsted
043dee5a54 ensure no tests share the same name (using flake8's checker) 2017-11-28 14:28:01 +00:00
Leo Hemsted
3ee351b802 remove unused db.py and add flake8 config 2017-11-28 14:26:40 +00:00
Leo Hemsted
9a0c01fee5 Merge pull request #1436 from alphagov/click-tweaks
Click tweaks
2017-11-28 14:26:29 +00:00
Rebecca Law
0d86738696 Merge branch 'master' into use-reply-to-in-send-to-provider 2017-11-28 13:20:26 +00:00
Rebecca Law
a7232381bf Merge pull request #1433 from alphagov/add-reply-to-notifications
Populate reply-to-text field in notifications
2017-11-28 13:19:36 +00:00
Leo Hemsted
5b7118973e take advantage of click's type validation/coercion
(saves us having to write the stuff ourselves). Also adds a small
click plugin to do datetime parsing.

Sample output:

```
[leohemsted:~/dev/api]$ flask command create_provider_rates --help
Usage: flask command create_provider_rates [OPTIONS]

  Backfill rates for a given provider

Options:
  -p, --provider_name [mmg|firetext|ses]
                                  [required]
  -c, --cost FLOAT                Cost (pence) per message including decimals
                                  [required]
  -d, --valid_from DATE           [required]
  --help                          Show this message and exit.
[leohemsted:~/dev/api]$ flask command create_provider_rates -p ses -c 1.234 -d invalid
Usage: flask command create_provider_rates [OPTIONS]

Error: Invalid value for "-d" / "--valid_from": Could not parse datetime string "invalid" formatted as %Y-%m-%dT%H:%M:%S
```
2017-11-28 12:50:29 +00:00
Rebecca Law
b0d88ec08c Updates as per review comments 2017-11-28 11:05:56 +00:00
Leo Hemsted
300ff0ebf6 Merge pull request #1435 from alphagov/fix-bad-test
fix test that did not depend on the notify-db-session fixture, so left a messy db
2017-11-28 11:02:55 +00:00
Leo Hemsted
2b54c2308b fix test that did not depend on the notify-db-session fixture, so left a messy db 2017-11-28 10:42:54 +00:00
Leo Hemsted
721202b44f use more click functionality to reduce our own codes' complexity 2017-11-28 10:35:46 +00:00
Leo Hemsted
fa3b48b357 Merge pull request #1421 from alphagov/celery-fix
celery.task.retry exc param should be a throwable.
2017-11-28 10:19:14 +00:00
pyup-bot
8b6036e0e2 Update pytest from 3.2.5 to 3.3.0 2017-11-27 22:37:37 +00:00
Rebecca Law
ab5b7c20a7 Use sms sender or reply to email address of the Notify service in create_2fa_code depending on message type. 2017-11-27 16:52:52 +00:00
Rebecca Law
caf810eb76 Select sms sender or email reply to when creating a 2fa code notification 2017-11-27 16:49:18 +00:00
Venus Bailey
9af2b54e48 Merge pull request #1413 from alphagov/pyup-update-boto3-1.4.7-to-1.4.8
Update boto3 to 1.4.8
2017-11-27 16:09:25 +00:00
Rebecca Law
03c3ebbbe7 Update send_to_providers and create_dvla_file_contents_for_notifications to use notification.reply_to_text.
The next thing to do is to stop updating the notification to sender mapping tables.
2017-11-27 15:24:16 +00:00
Leo Hemsted
1e4a480298 only catch s3 and db errors in build-dvla-file-for-job
this reduces the amount of error messages we log (we'll no longer log
at error level when build-dvla-file-for-job retries while waiting for
the task to finish), and make sure we retry in those cases above - db
or s3 having temporary troubl
2017-11-27 15:11:58 +00:00
Leo Hemsted
b6ac7f074d celery.task.retry exc param should be a throwable.
This causes an issue when it hits the max retry limit, and tries to
throw your exception to let you deal with it - at this point it was
moaning because we pass in a string

if it's not defined, and we're inside an exception block celery uses
that instead.
2017-11-27 14:55:29 +00:00
Rebecca Law
4ecf168590 Upate test for persist_notification 2017-11-27 14:45:34 +00:00
venusbb
3945007d24 add reply-to-text to user/rest persist notifications 2017-11-27 14:36:54 +00:00
Leo Hemsted
2ddf05a645 Merge pull request #1432 from alphagov/cf-deploy-sleep
Add sleep after stopping the old app instances on deploy
2017-11-27 14:15:09 +00:00
venusbb
e1175542b7 add reply-to-text to send notification to service users 2017-11-27 14:05:04 +00:00
Rebecca Law
ecde8b6575 Merge pull request #1431 from alphagov/add-reply-to-model
Add reply_to_text to Notification model.
2017-11-27 14:04:54 +00:00
venusbb
a97d946d2d Merge branch 'master' of https://github.com/alphagov/notifications-api into add-reply-to-notifications 2017-11-27 13:53:37 +00:00
Leo Hemsted
bcee95214e Add sleep after stopping the old app instances on deploy
sleep for 10 seconds to try and make sure that all worker threads
(either web api or celery) have finished before we delete when we
delete the DB is unbound from the app, which can cause
"permission denied for relation" psycopg2 errors.
2017-11-27 13:46:39 +00:00
Rebecca Law
86098041fa Add reply_to_text to Notification model.
This was missed out of the previous PR and needs to be there before the next PR is merged.
2017-11-27 13:39:35 +00:00
Richard Chapman
e2dad7c94e Merge pull request #1430 from alphagov/rc-monthly-template-usage-endpoint
Removed the templates/monthly endpoint
2017-11-27 13:05:00 +00:00
Rebecca Law
530f2e7f6a Update invite user endpoint to set the reply_to_text on the notification.
Update v1 post notifications to set the reply_to_text on the notification.
2017-11-27 12:30:50 +00:00
Rebecca Law
12024e9619 Update save_letter task to save the default letter contact block when creating the notification. 2017-11-27 11:33:04 +00:00
Richard Chapman
adfba208c4 Removed the templates/monthly endpoint
Removed the REST endpoint and the DAO that it uses as the endpoint is
no longer used by the Admin UI and the DAO is not reused anywhere
else.

- Removed REST endpoint
- Removed DAO which gets the stats
- Removed associated tests of both methods
2017-11-27 11:06:43 +00:00