Fix using the @requires_user_profile decorator with unit test classes.

Review Request #10987 — Created April 3, 2020 and submitted


The @requires_user_profile decorator was added back when modern avatar
support was added, and one of its capabilities was to decorate a class
in order to decorate all test methods within.

This didn't actually work. Any class using this decorator would fail to
have its tests run. This was due to the initial check to determine if
this was decorating a function or a class by checking the result of
callable(...). Since unit test classes are callable, this passed. It
would then break running the test suite, which would cause the test
runner to ignore the class entirely.

We now check if it's a class directly instead, invoking the
class-specific logic for the first time. That logic unfortunately didn't
work, as it was trying to modify an immutable dictionary. This change
also fixes that, using setattr() instead.

Verified that the unit tests that weren't running before do run now.

Fix using the @requires_user_profile decorator with unit test classes.
  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (2f5ed41)