-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: move mako logic to init method #98
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""This file contains all the test for the init_pipeline.py file. | ||
|
||
Classes: | ||
RunInitPipelineTestCase: Tests cases for run_init_pipeline method. | ||
SetMakoTemplatesTestCase: Tests cases for set_mako_templates method. | ||
""" | ||
import os | ||
from unittest.mock import call | ||
|
||
from django.test import TestCase | ||
from mock import patch | ||
|
||
from eox_nelp.course_experience.frontend import templates as course_experience_templates | ||
from eox_nelp.edxapp_wrapper.edxmako import edxmako | ||
from eox_nelp.init_pipeline import run_init_pipeline, set_mako_templates | ||
from eox_nelp.stats import templates as stats_templates | ||
|
||
|
||
class RunInitPipelineTestCase(TestCase): | ||
"""Test class for run_init_pipeline method.""" | ||
|
||
@patch("eox_nelp.init_pipeline.patch_user_gender_choices") | ||
@patch("eox_nelp.init_pipeline.set_mako_templates") | ||
def test_pipeline_execute_expected_methods(self, set_mako_templates_mock, patch_user_gender_choices_mock): | ||
""" Test that method calls the expected methods during the pipeline execution. | ||
|
||
Expected behavior: | ||
- set_mako_templates_mock is called once. | ||
- patch_user_gender_choices_mock is called once. | ||
""" | ||
run_init_pipeline() | ||
|
||
set_mako_templates_mock.assert_called_once() | ||
patch_user_gender_choices_mock.assert_called_once() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok this add gender choices called test xD |
||
|
||
|
||
class SetMakoTemplatesTestCase(TestCase): | ||
"""Test class for set_mako_templates method.""" | ||
|
||
def test_edxmako_adds_expected_paths(self): | ||
""" Test that method adds the expected template paths. | ||
|
||
Expected behavior: | ||
- `edxmako.paths.add_lookup` is called with the expected paths. | ||
""" | ||
set_mako_templates() | ||
|
||
edxmako.paths.add_lookup.assert_has_calls([ | ||
call('main', os.path.dirname(stats_templates.__file__)), | ||
call('main', os.path.dirname(course_experience_templates.__file__)), | ||
]) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is need the arg "main" to this render_to_response method,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think this is related to that main dirs or something to do it with that way.
https://github.com/eduNEXT/eox-nelp/pull/98/files#diff-ec9dfd84694298d271197a0909b7b62e0301e9df3dce5c29d0cec0a8255ebd42L19
eox-nelp/eox_nelp/templates_config.py
Line 19 in 13ed2ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works without those extra parameters(main and request), however when I was testing that raised an missing parameters error so I decided to pass the default value for the namespace as we do in the current implementation and the current request