Project

Profile

Help

Refactor #93

closed

Make @auth_required testable and write a few examples

Added by bmbouter over 9 years ago. Updated about 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
2.7.0
Groomed:
Sprint Candidate:
Tags:
Pulp 2
Sprint:
January 2015
Quarter:

Description

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.

Also available in: Atom PDF