Skip to content

Conversation

goodtune
Copy link
Contributor

@goodtune goodtune commented Oct 6, 2025

Added convenience wrapper for Django's MessagesTestMixin.assertMessages:

  • Uses self.last_response by default following library conventions
  • Clean compatibility wrapper in compat.py with single try/except
  • Comprehensive tests with proper Message construction
  • Documentation with examples and Django version skip pattern
  • Test view and URL for demonstration

Ref: https://docs.djangoproject.com/en/5.0/ref/contrib/messages/#testing

Added convenience wrapper for Django's `MessagesTestMixin.assertMessages`:
- Uses `self.last_response` by default following library conventions
- Clean compatibility wrapper in `compat.py` with single try/except
- Comprehensive tests with proper `Message` construction
- Documentation with examples and Django version skip pattern
- Test view and URL for demonstration
The `Message` class is only available in Django 5.0+, causing import errors in Django 4.2. Wrapped the import in a try/except block to handle older Django versions gracefully.
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