Skip to content

Conversation

csbarnet
Copy link

This PR addresses the issue reported here: #791
It also adds tests for this view.

A couple of things worth noting:
Although the main change was the change from 'request.is_ajax' to 'request.get("x-requested-with") == "XMLHttpRequest"', a couple of changes were made to enable testing.

I changed the way ALLOCATION_ACCOUNT_ENABLED was accessed from settings to enable testing. Originally, this value is assigned to a constant at the top of the file, so that it is only evaluated on import. However, this view is only accessible when this setting is assigned the non-default value. Using 'import_from_settings' in the view allows us to inject different values for the setting at test time using the 'override_settings' annotation.

I also changed the setup in the test for creation of the pi user to enable request.user.userprofile.is_pi to return True for a PI user.

…aced ALLOCATION_ACCOUNT_ENABLED constant with call to settings to enable testing updated user test for pi status to enable testing created tests for AllocationAccountCreateView

Signed-off-by: Chris Barnett <[email protected]>

update creation of pi user in test setup to set userprofile.is_pi to True

Signed-off-by: Chris Barnett <[email protected]>
@csbarnet csbarnet force-pushed the bug-fix-allocation-account branch from 727c8d0 to 39fd83a Compare October 2, 2025 14:06
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.

1 participant