fecgov / fecfile-web-api

Back-end API for FECfile application
7 stars 2 forks source link

Limit hard delete utility endpoint to just the test committee #931

Open mjtravers opened 1 week ago

mjtravers commented 1 week ago

Change the hard-delete-reports endpoint to only clear the records for the e2e test committee. While prototyping the api early on, a convenience endpoint was created to clear out the data of a committee for testers. This endpoint could clear out any committee data if the user could successfully login into the back end.

By default, the entity ViewSets (reports, transactions, memos, etc.) extend the CommitteeOwnedViewMixin which enforces access of the user to only the committee that they are currently have set for their session. This is done by using the Django queryset. The utility delete endpoint accessed other committee records by using the models.objects property to access the records directly outside of the queryset.

Endpoint: https://github.com/fecgov/fecfile-web-api/blob/develop/django-backend/fecfiler/reports/views.py#L144-L178

Update this api endpoint to only clear out the test committee used by the e2e tests.

QA Notes

Ticket passes when it is verified that only the e2e test committee has records removed when using the reports/hard-delete-reports endpoint.

DEV Notes

null

Design

null

FECFILE-1438

GreggMoreland commented 2 days ago

@mjtravers Is there a pull request for this? In Jira, it requires a pull request for anything in Code Review

mjtravers commented 2 days ago

Passes CR. Sending to QA.

Passes unit tests: https://app.circleci.com/pipelines/github/fecgov/fecfile-web-api/3877/workflows/a776e5b8-9631-46a7-8351-7286d50f9f97/jobs/11683

Image

e2e tests are clearing out the database properly https://app.circleci.com/pipelines/github/fecgov/fecfile-web-app/5997/workflows/bd703e4d-6827-437d-8ae2-2f37dc17e05a/jobs/20685

Image