sample-platform
sample-platform copied to clipboard
[IMPROVEMENT] Find a way to mock `template_renderer`
Please prefix your issue with one of the following: [BUG], [PROPOSAL], [QUESTION].
Sample platform commit (found at the bottom of each page) : X.X.X
In raising this issue, I confirm the following (please check boxes, eg [X]):
- [ ] I have read and understood the contributors guide.
- [ ] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
- [ ] I have checked that the issue I'm posting isn't already reported.
- [ ] I have checked that the issue I'm posting isn't already solved and no duplicates exist in closed issues and in opened issues
- [ ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
My familiarity with the project is as follows (check one, eg [X]):
- [ ] I have never visited/used the platform.
- [ ] I have used the platform just a couple of times.
- [ ] I have used the platform extensively, but have not contributed previously.
- [ ] I am an active contributor to the platform.
Unittests for mod_auth were added in #302 but we were not able to mock template_renderer which decorates a lot of the functions and due to this the testing is not rigorous.
Here is an example testcase which fails to mock template_renderer.
A way is required to mock the same and improve the testing.
A way to bypass login_required decorator is to create a dummy user and login with the same for the duration of the request.
@thealphadollar yes, there is already lot of tests bypass login_required. you can follow the same technique. https://github.com/CCExtractor/sample-platform/blob/master/tests/test_customized/TestControllers.py#L22
@satyammittal Mocking it is also easy, I need to find a way to mock template_renderer :D