Conversation
📝 WalkthroughWalkthroughAdds new tests for the saved_views context processor and MusicBrainz search view, and replaces inline back-button markup with a shared partial across several templates (plus a new back_button partial). Also disables autocomplete on certain media_import inputs and adjusts profile header markup. Changes
Sequence Diagram(s)Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/tests/core/test_musicbrainz.py`:
- Around line 76-81: The test_preserves_query_in_context currently makes an
unmocked request and may hit the real MusicBrainz API; update the test to mock
the MusicBrainz client used by the view (same approach as
test_returns_search_results) so the view path that performs searches is stubbed
out — e.g., patch the client/class or method the view imports (referencing the
test function name test_preserves_query_in_context and the view
reverse("musicbrainz_search_htmx")) and ensure the mock returns an
empty/controlled response before calling logged_in_client.get(..., {"q":"test"})
so no network calls occur and the assertion on response.context["query"] remains
valid.
🧹 Nitpick comments (2)
src/tests/core/test_context_processors.py (1)
52-63: Consider moving the import to the top of the file.The test logic is correct. However, the
AnonymousUserimport on line 54 could be moved to the module's import section for consistency.♻️ Suggested refactor
from django.test import RequestFactory +from django.contrib.auth.models import AnonymousUser from core.context_processors import saved_views from core.models import SavedViewThen remove the local import on line 54.
src/tests/core/test_musicbrainz.py (1)
33-54: Consider verifying the search query argument.The test correctly mocks the MusicBrainz client and verifies results. For more precise verification, you could use
assert_called_once_withto confirm the correct query was passed to the client.♻️ Suggested improvement
- mock_client.search_releases.assert_called_once() + mock_client.search_releases.assert_called_once_with("abbey road")
Also harmonises back buttons across the application.
No description provided.