-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add UserLanguagePreferenceMiddlewere tests
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
eox_core/edxapp_wrapper/backends/lang_pref_middleware_p_v1_test.py
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,16 @@ | ||
""" | ||
LanguagePreferenceMiddleware Backend. | ||
""" | ||
|
||
def get_language_preference_middleware(): | ||
"""Backend to get the LanguagePreferenceMiddleware from openedx.""" | ||
class LanguagePreferenceMiddleware: | ||
def __init__(self, get_response): | ||
self.get_response = get_response | ||
|
||
def __call__(self, request): | ||
# Simulate the behavior of LanguagePreferenceMiddleware | ||
# For example, set a language preference in the request | ||
request.LANGUAGE_CODE = 'en' | ||
return self.get_response(request) | ||
return LanguagePreferenceMiddleware |
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