

def test_user_passes_test_composition(self):
    '\n        Test that the user_passes_test decorator can be applied multiple times\n        (#9474).\n        '

    def test1(user):
        user.decorators_applied.append('test1')
        return True

    def test2(user):
        user.decorators_applied.append('test2')
        return True

    def callback(request):
        return request.user.decorators_applied
    callback = user_passes_test(test1)(callback)
    callback = user_passes_test(test2)(callback)

    class DummyUser(object):
        pass

    class DummyRequest(object):
        pass
    request = DummyRequest()
    request.user = DummyUser()
    request.user.decorators_applied = []
    response = callback(request)
    self.assertEqual(response, ['test2', 'test1'])

dataset/ETHPy150Open django/django/tests/decorators/tests.py DecoratorsTest.test_user_passes_test_composition/original