fecgov / fecfile-web-api

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

feature/1552 - django key fallbacks #1052

Closed dheitzer closed 1 month ago

dheitzer commented 2 months ago

Summary

https://fecgov.atlassian.net/browse/FECFILE-1552

How to test

New commands to support this functionality are documented in the devops app README with a SOP for both the django key and login cert rotation being uploaded to the shared drive.

Unfortunately Django commands to not support sub directories so some devops commands were renamed for clarity.

Both commands tested in the develop environment.

sasha-dresden commented 2 months ago

This looks great but I think we might want some tests for the commands. I'm not quite sure how challenging this would be to implement, but I did some quick research and it looks like we can use call_command and patch to simulate running these commands in a test https://docs.djangoproject.com/en/5.1/ref/django-admin/#running-management-commands-from-your-code https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
7 New issues
0 Accepted issues

Measures
0 Security Hotspots
96.6% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

dheitzer commented 1 month ago

This looks great but I think we might want some tests for the commands. I'm not quite sure how challenging this would be to implement, but I did some quick research and it looks like we can use call_command and patch to simulate running these commands in a test https://docs.djangoproject.com/en/5.1/ref/django-admin/#running-management-commands-from-your-code https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch

good catch - I added coverage to these cmds