Make @auth_required testable and write a few examples
This is a task related to the Django conversion work. Currently the testing methodology expects to make assertions about the decorators that are present over each Django URL handler. The decorator currently is not able to be tested without a large number of mock gymnastics. bmbouter has prototyped an adjustment to the decorator whereby the decorators itself calls an external function which can be mocked directly instead of mocking all calls the decorated function calls out to. This works around the central difficulty that decorated functions are stored in a closure and are not able to be mocked directly.
This task is to convert that prototype into production-grade code which includes:
1. Writing a generic replacement function that accepts test-driven assertion values about which permissions should be present when the decorator is called.
2. Use the helper function from (1) to add the desired assertion functionality to some actual Django URL handlers (to provide examples of usage for others).
3. Review the code once more to ensure there are no side effects and that we're good to go.
Updated by bmbouter about 8 years ago
This has been merged into the feature branch 'introducing-django' on pulp/pulp, but we need to leave this at POST until the feature branch is merged back into master. This is planned to be done near the end of the Jan 2015 at which point this can be moved to modified.