Rebecca Law
85a0fd3b46
Merge pull request #2031 from alphagov/fix_data_retention
...
Use days of retention when deleting notifications in the nightly job.
2018-08-10 15:35:42 +01:00
Leo Hemsted
62d70dbd4d
use contextmanager freeze time instead of decorator
...
it doesn't appear to work nicely with pytest fixtures in the newer
versions of pytest
2018-08-09 16:47:35 +01:00
Rebecca Law
d0e9ab4972
If the notifications that are being deleted are letters then we need to delete the letter from s3 as well.
2018-08-08 16:20:25 +01:00
Leo Hemsted
cb7f5a7166
fix letters being put in the wrong bucket when near midnight cut-off
...
another day, another timezone bug
2018-07-02 14:16:40 +01:00
Rebecca Law
41f3293cd5
This fixes a bug where the folder name was not correctly returning the right date because date used to compare was in UTC but the datetime used for the job start time is in BST.
...
Units tests have been added for the affected method.
2018-05-30 10:18:37 +01:00
Rebecca Law
b73bf4220f
Refactor process_letter_notification to make the code easier to read.
...
- Separated the logic of precompiled and template letters.
- Remove the check for research mode, research mode is not relevant to api calls. The test key is used for testing.
Refactor upload_pdf_letter to accept a precompile boolean to save a query to template.
2018-04-09 13:56:44 +01:00
Ken Tsang
0e6907aba7
Refactor letter utils tests
...
- tests were failing as creating duplicate buckets
2018-03-29 14:28:06 +01:00
Richard Chapman
8b6d28d3b0
Added a new task to handle any error cases with the anti-virus
...
application. If the Anti-virus app fails due to s3 errors or ClamAV
so does not scan (even after retries) the file at all an error needs
to be raised and the notification set to technical-failure.
Files should be moved to a 'folder' a separate one for ERROR and FAILURE.
* Added new letter task to process the error
* Added a new method to letter utils.py to move a file into an error or
failure folder based on the input
* Added tests to test the task and the utils.py method
2018-03-26 14:18:44 +01:00
Ken Tsang
1a9bc2a5cf
Move test letters to test letters bucket without date folder name
2018-03-23 14:59:48 +00:00
Ken Tsang
0ee5c33084
Add antivirus check on precompiled letters sent with test key
...
- precompiled PDFs sent by test key uploaded to scan bucket
- set status to VIRUS-SCAN-FAILED for pdfs failing virus scan rather than PERMANENT-FAILURE
- Make call to AV app for precompiled letters sent via a test key, and set notification status to PENDING-VIRUS-SCAN
2018-03-23 12:04:37 +00:00
Ken Tsang
0c102f0727
Update letter utils for methods to handle virus process
...
- add function to get reference from filename
- add function to move pdf from scan folder to process folder
- add function to delete pdfs from scan bucket for failed virus scans
2018-03-20 10:12:59 +00:00
Ken Tsang
8733d84e75
Upload precompiled letter pdfs to letters-scan bucket
2018-03-20 10:11:36 +00:00
Ken Tsang
d40bc28f2a
Add test-letters bucket for precompiled test keys
...
- uses moto to mock out boto3 for testing
2018-03-14 21:27:07 +00:00
Ken Tsang
c4e1d56492
Update letter utils to handle precompiled letters sent by test API keys
...
- precompiled letters sent using a test key should be put into a test-letters bucket
- also refactored code from test_letter_pdf_tasks
2018-03-14 18:15:00 +00:00
Ken Tsang
7011b90bd4
Refactor is_precompiled_letter to model
2018-03-07 23:03:03 +00:00
Richard Chapman
033a4099bc
Added tests for all conditions for s_precompiled_letter.
...
* Added tests for hidden = true but name not precompiled
* Added test where name is precompiled but hidden is false
2018-03-05 16:57:48 +00:00
Richard Chapman
a4feaba309
Added tests to tests for precompiled flow and refactored a little
...
* Added is_precompiled_letter method to letter/utils.py
* Added tests for letter/utils.py
* Added tests for the rest endpoint
* Moved the Precompiled name to a central location
* Added hidden field to the test method to create a template
2018-03-05 14:11:37 +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
2c758cbccd
use new send-jobs-to-dvla task instead of send-files-to-dvla
...
the tasks (on the ftp app) do the same thing, but to improve clarity
i've renamed it to jobs, because we'll be adding a notifications one
soon
2017-09-12 17:28:07 +01:00
Ken Tsang
d391919677
Refactored to check trial when running scheduled job
2017-08-30 22:30:05 +01:00
Ken Tsang
8c4a084a0d
Refactor letters filename
2017-08-23 13:22:07 +01:00
Leo Hemsted
5d61b3644c
add tests for new test-key handling
2017-08-02 11:14:05 +01:00
Martyn Inglis
2591d3a1df
This massive set of changes uses the new queue names object throughout the app and tests.
...
Lots of changes, all changing the line of code that puts things into queues, and the code that tests that.
2017-05-25 10:51:49 +01:00
Ken Tsang
c1ae3369a6
Update test for 201 response from send_letter_jobs
2017-04-11 16:53:30 +01:00
Ken Tsang
155e173363
Update send letter jobs to return json
2017-04-11 15:44:33 +01:00
Rebecca Law
5a810a47ac
Fix type with status
2017-04-07 13:38:30 +01:00
Rebecca Law
22fc9e3c81
Fix dependency issue. When you import schemas in a test you need to do it locally in the method.
...
I've just taked it out all together.
2017-04-07 12:29:53 +01:00
Rebecca Law
f7ab49246a
Added an endpoint that returns all letter jobs, ordered by created_at desc.
2017-04-07 11:50:56 +01:00
Rebecca Law
a9e429b09f
Fix task name, should have dashes not underscores
2017-04-06 15:26:50 +01:00
Rebecca Law
1d46dd0be1
Remove bucket-name from the task.
2017-04-06 15:03:06 +01:00
Rebecca Law
7bd0a07f0d
Added bucket name to task arguments.
2017-04-06 12:18:34 +01:00
Rebecca Law
970a4e7b4e
New endpoint to send a list of job ids to a queue.
...
The task will be picked up by the FTP app. Given the list of job ids the tasks will get all the files from s3, aggregate them then send to dvla
2017-04-06 12:14:17 +01:00