Skip to content

fix: patch ENABLE_MYOPENCRE in csv tests to bypass feature flag gate#884

Open
shiwani42 wants to merge 1 commit intoOWASP:mainfrom
shiwani42:fix/test-myopencre-flag
Open

fix: patch ENABLE_MYOPENCRE in csv tests to bypass feature flag gate#884
shiwani42 wants to merge 1 commit intoOWASP:mainfrom
shiwani42:fix/test-myopencre-flag

Conversation

@shiwani42
Copy link
Copy Markdown

Closes #871

Summary

test_get_cre_csv and test_import_from_cre_csv were always returning 404 because ENABLE_MYOPENCRE is imported as a plain boolean at module load time in web_main.py. Setting os.environ after import has no effect on the cached value. Patching application.web.web_main.ENABLE_MYOPENCRE directly ensures the routes are reachable during tests.

Note: a related improvement around reading ENABLE_MYOPENCRE and GAP_ANALYSIS_OPTIMIZED dynamically at request time rather than at import time was flagged in the issue thread. That is out of scope for this fix but worth a separate issue.

Changes

  • Patch application.web.web_main.ENABLE_MYOPENCRE to True in both test_get_cre_csv and test_import_from_cre_csv

Test plan

ENABLE_MYOPENCRE is imported as a plain boolean at module load time in web_main.py, so setting os.environ after import has no effect. Patch application.web.web_main.ENABLE_MYOPENCRE directly so the routes are reachable in tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_get_cre_csv and test_import_from_cre_csv always return 404 because ENABLE_MYOPENCRE is never set in tests

1 participant