Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVEMENT] Find a way to mock template_renderer #305

Open
9 tasks
thealphadollar opened this issue Jun 20, 2019 · 3 comments
Open
9 tasks

[IMPROVEMENT] Find a way to mock template_renderer #305

thealphadollar opened this issue Jun 20, 2019 · 3 comments

Comments

@thealphadollar
Copy link
Contributor

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.

@thealphadollar
Copy link
Contributor Author

A way to bypass login_required decorator is to create a dummy user and login with the same for the duration of the request.

@satyammittal
Copy link
Member

@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

@thealphadollar
Copy link
Contributor Author

@satyammittal Mocking it is also easy, I need to find a way to mock template_renderer :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants