Fix unit test regressions with badges and conditionally access context.

Review Request #14368 — Created March 14, 2025 and discarded — Latest diff uploaded

Information

Review Board
release-7.1.x

Reviewers

When get_user_badges() was updated to take a local_site= parameter,
two unit tests failed to get the update. They were caught up in a stash.
These have been updated to take **kwargs.

Badge calculation also assumed the existence of request.local_site and
context['request']`, but these aren't always available, at least in unit
tests. We now access these conditionally.

All unit tests pass.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Fix unit test regressions with badges and conditionally access context.
When `get_user_badges()` was updated to take a `local_site=` parameter, two unit tests failed to get the update. They were caught up in a stash. These have been updated to take `**kwargs`. Badge calculation also assumed the existence of `request.local_site` and context['request']`, but these aren't always available, at least in unit tests. We now access these conditionally.
40f37da00d2fef339731e08527aaf5b1104c41fc Christian Hammond
reviewboard/accounts/templatetags/accounts.py
reviewboard/accounts/tests/test_template_tags.py
Loading...