Fix issues with the new kgb on Django 1.11 and in @requires_user_profile.
Review Request #9668 — Created Feb. 18, 2018 and submitted — Latest diff uploaded
The new version of kgb made some changes that resulted in more strict
function signatures. While most of these were fixed, there were a few
signatures found that were not compatible with Django 1.11 (which added
new optional arguments not handled by our overriding functions). These
were fixed up to take variable arguments.The
@requires_user_profile
decorator was also impacted, but in a
different way. It was checking for a particular attribute on a function
to determine if it was a spy, but the attribute chosen wasn't considered
public, and has since changed. This was updated to check for theunspy
method instead, which is safer and prevents unit tests from leaking
state.
Unit tests pass with kgb 2.0 for Django 1.6 and 1.11 (when used along
with other pending changes).