Skip to content

Conversation

@adityashirsatrao007
Copy link
Contributor

Summary

Adds unit tests for the \get_search_results\ method in the \LogEntrytAdmin\ class.

Tests Added

  • \ est_get_search_results_with_id_prefix_uppercase\ - Tests searching with 'ID123' format
  • \ est_get_search_results_with_id_prefix_lowercase\ - Tests searching with 'id123' format
  • \ est_get_search_results_with_object_id\ - Tests searching by object_id
  • \ est_get_search_results_with_change_message\ - Tests searching by change_message content
  • \ est_get_search_results_empty_term\ - Tests that empty search term calls parent method
  • \ est_get_search_results_no_match_in_change_message\ - Tests non-matching change_message returns empty

Testing

\
python manage.py test tests.common.test_log_entry_admin --keepdb
\\

Closes #355

Tests cover:
- Searching with 'ID123' format (uppercase)
- Searching with 'id123' format (lowercase)
- Searching by object_id
- Searching by change_message content
- Empty search term behavior
- Non-matching change_message

Closes DjangoCRM#355
Copilot AI review requested due to automatic review settings December 10, 2025 18:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive unit tests for the get_search_results method in the LogEntrytAdmin class (note: this class name contains a typo - it should be LogEntryAdmin). The tests verify various search patterns including uppercase/lowercase ID prefixes, object ID searches, change message searches, empty search terms, and non-matching scenarios.

Key Changes

  • Added 6 test methods covering different search patterns for the admin interface
  • Tests verify ID-based searches (e.g., 'ID123', 'id123'), object_id searches, and change_message content searches
  • Includes edge case testing for empty search terms and non-matching queries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DjangoCRM
Copy link
Owner

@adityashirsatrao007 Thank you!

@DjangoCRM DjangoCRM merged commit fff4fec into DjangoCRM:main Dec 17, 2025
6 checks passed
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.

Write a unit test for the get_search_results method of LogEntrytAdmin class.

2 participants