52 Commits

Author SHA1 Message Date
graham-dds
9de90d796d Rename audit log feature flag config variable 2019-10-21 11:36:53 -04:00
graham-dds
a1c672d89f Conditionally skip tests related to audit log 2019-10-21 11:36:53 -04:00
dandds
7010bdb09c Record job failures with application context.
AT-AT needs to be able to track which user tasks failed and why. To
accomplish this we:

- Enabled Celery's results backend, which logs task results to a data
  store; a Postgres table, in our case.
  (https://docs.celeryproject.org/en/latest/userguide/tasks.html#result-backends)
- Created tables to track the relationships between the relevant models
  (Environment, EnvironmentRole) and their task failures.
- Added an `on_failure` hook that tasks can use. The hook will add
  records to the job failure tables.

Now a resource like an `Environment` has access to it task failures
through the corresponding failure table.

Notes:
- It might prove useful to use a real foreign key to the Celery results
  table eventually. I did not do it here because it requires that we
  explicitly store the Celery results table schema as a migration and
  add a model for it. In the current implementation, AT-AT can be
  agnostic about where the results live.
- We store the task results indefinitely, so it is important to specify
  tasks for which we do not care about the results (like `send_mail`)
  via the `ignore_result` kwarg.
2019-09-09 14:54:46 -04:00
dandds
d62027b2e7
Merge pull request #1046 from dod-ccpo/tests-debug
Enable debug mode in tests.
2019-09-03 16:08:42 -04:00
dandds
883947b75f Enable debug mode in tests.
Debug mode allows route integration tests to raise explicit exceptions on
errors, instead of returning error pages. Some portions of the test
suite need to be able to ignore exceptions (the response is not under
test) so they use a separate pytest fixture version of the app and
client that are configured with debug disabled, as it would be in
production.
2019-08-30 15:32:57 -04:00
dandds
d7478e322a Use Celery instead of RQ.
Celery provides a more robust set of queueing options for both tasks and
worker processes. Updates include:
- infrastructure necessary to run Celery, including celery entrypoint
- backgrounded functions are now imported directly from atst.jobs
- update tests as-needed
- update kubernetes worker pod command
2019-08-29 09:33:47 -04:00
richard-dds
fe5def3a92 Send notification emails on some http errors 2019-05-15 15:01:49 -04:00
richard-dds
9399b34a56 Autouse notification_sender fixture 2019-05-15 14:57:46 -04:00
richard-dds
9ba1def91c Use separate queue method for notifications 2019-05-15 14:57:46 -04:00
richard-dds
9e97df79f5 Mock out app NotificationSender during testing 2019-05-15 14:57:46 -04:00
richard-dds
df7f72245a Send notification when we encounter an error 2019-05-15 14:57:46 -04:00
Montana
86f106f6d1 Test logging events for auditable mixin 2019-04-03 17:07:33 -04:00
Montana
280775fa66 Fix test that produces CRLRevocationException 2019-03-14 13:44:54 -04:00
Montana
5782c30a7d Use pytest fixture for app with non default configs 2019-03-14 13:42:12 -04:00
Montana
2eeb548458 Move crl fixtures to conftest 2019-03-14 13:42:12 -04:00
dandds
44d52ae601 fix crl storage config name 2019-03-01 15:31:02 -05:00
Montana
d51663e075 Refactor RequiredIf validator 2019-01-20 09:50:20 -05:00
Montana
ae494d3bb5 Refactor RequiredIfNot custom validator, add tests 2019-01-16 11:00:51 -05:00
dandds
e509c34cdd change name of request relationship to legacy task order 2018-12-13 11:36:45 -05:00
richard-dds
de0e9ee705 Fix PDF clearing bug 2018-11-12 10:37:26 -05:00
richard-dds
85034185bc Handle request status event transitions 2018-10-29 14:57:25 -04:00
richard-dds
f3be2d76ea Create queue fixture 2018-10-29 12:01:45 -04:00
dandds
95ad71605d set default task queue name based on ATAT environment 2018-10-15 11:38:34 -04:00
dandds
df35725430 reformat files, add more tests 2018-10-15 11:38:34 -04:00
richard-dds
ddc2e2fad7 Automatic audit logging using SQLA events 2018-09-25 13:09:54 -04:00
dandds
a2e8caf23b add expiration_date to manual task order form 2018-09-17 16:56:10 -04:00
Montana
cfe9b7589e Formatting 2018-08-27 13:08:02 -04:00
Montana
4f9e7c3408 Fix tests, add financial verification data fixture 2018-08-27 13:07:14 -04:00
dandds
54d1e7235b add attachment model and task order relation to it 2018-08-27 13:04:41 -04:00
richard-dds
daa8634cb4 Format project 2018-08-23 16:25:36 -04:00
dandds
4c587864ef add Requests method for counting all requests with a given status 2018-08-14 16:23:41 -04:00
dandds
f68e5a5ed2 no logger for tests 2018-08-09 15:04:19 -04:00
richard-dds
d307a255b1 Fix some issues from a tricky merge 2018-08-08 15:46:16 -04:00
dandds
033578fa21 implement database sessions for test factories 2018-08-07 15:23:50 -04:00
dandds
be079a62dc apply auth requirement to virtually all endpoints 2018-08-06 10:45:33 -04:00
richard-dds
13146e9362 Implement log_in_user 2018-08-06 10:44:00 -04:00
richard-dds
7b5d76e260 Install pytest-flask as a dev package 2018-08-06 10:44:00 -04:00
dandds
45b47c41bf update tests for Flask 2018-08-02 16:03:54 -04:00
dandds
ba4ea97d4b remove reference to fundz in config and api mocks 2018-07-31 11:50:34 -04:00
dandds
cb30ee99ca remove fundz_client in favor of pe numbers repo 2018-07-31 11:50:33 -04:00
richard-dds
d207b259cf Fix linting errors 2018-07-31 11:50:33 -04:00
dandds
202f88bae5 update handlers to user Users repo for managing authorization 2018-07-31 11:50:33 -04:00
richard-dds
12507109ac update tests, remove MockRequestsClient 2018-07-31 11:50:00 -04:00
richard-dds
4291b614c9 Add request domain tests and factories 2018-07-31 11:49:06 -04:00
Patrick Smith
355d2ed36a Add tests for PE id validation 2018-07-19 11:30:03 -04:00
richard-dds
e48644fb44 Create authz users on login 2018-07-16 13:19:35 -04:00
Patrick Smith
3925007489 Add tests for some validators 2018-07-11 10:54:04 -04:00
richard-dds
118a84560a Add simple session management using redis 2018-06-27 16:07:25 -04:00
richard-dds
f9335c7a4e Use black for formatting 2018-06-26 10:31:39 -04:00
richard-dds
92086a898f Add MockRequestsClient 2018-06-19 14:03:42 -04:00