Skip to content

Conversation

@simonLeary42
Copy link
Contributor

While writing tests, I discovered that allocation/views.py likes to do message.error followed by HttpResponseRedirect, and the test cases only check response.status_code, which is either 200 or 301, depending on if follow was specified. I added a new utility to check both response.status_code and check for error messages.

  • tests tweaked to check for error messages:
    • test_allocationchangedetailview_post_deny
    • test_allocationchangeview_post_extension
    • test_allocationchangeview_post_no_change
    • test_allocationcreateview_post_zeroquantity
    • test_centersummary_renders
  • other test changes:
    • test_allocationchangedetailview_access renamed to test_allocationchangedetailview_access_granted to differentiate it from test_allocationchangedetailview_access_denied
    • test_allocationchangeview_post_extension:
      • created local copy of self.post_data to prevent this test from messing up other tests with its specific post_data
      • added more specific assertion
    • AllocationViewBaseTest:
      • added type hints to object attributes
      • added end_date to cls.allocation so that the new end date could be calculated after approving an end date extension
      • made cls.quota_attribute.allocation_attribute_type changeable
    • test_allocationchangedetailview_post_deny: tweaked to use status.name (string) instead of status_id (object primary key), more intuitive
  • new tests added:
    • test_allocationchangedetailview_access_denied
    • test_allocationchangedetailview_post_approve_end_date_extension
    • test_allocationchangedetailview_post_approve_attribute_change
    • test_allocationchangedetailview_post_update_end_date_extension
    • test_allocationchangeview_post_attribute_change

Also added documentation to explain the diffrence between AllocationChangeView and AllocationChangeDetailView, and their get_allocation_attributes_to_change, which share the same name but do different things.

@simonLeary42 simonLeary42 mentioned this pull request Oct 26, 2025
@simonLeary42
Copy link
Contributor Author

CI failure is fixed by #847

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