Allow @requires_user_profile to decorate classes as well
Review Request #9950 — Created May 16, 2018 and submitted — Latest diff uploaded
Djblets provided
@requires_user_profile
to ensure that theUser
model has aget_profile
method so that unit tests can run across
Django 1.6 (whereUser.get_profile
exists) and Django 1.7+ (where it
has been removed).This decorator has been updated to also work for classes. When applied
to a class, it will apply the decorator to all methods in the class that
begin withtest_
. In other words, it has the same effect as manually
applying the decorator to each test method in the class.
Ran unit tests on Django 1.6.11 and Django 1.8.19.