Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
1c188c9f
Commit
1c188c9f
authored
Feb 12, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send language preference to the comments service
parent
5841d460
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
+23
-1
lms/djangoapps/django_comment_client/forum/tests.py
+19
-0
lms/lib/comment_client/utils.py
+4
-1
No files found.
lms/djangoapps/django_comment_client/forum/tests.py
View file @
1c188c9f
...
...
@@ -271,6 +271,25 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
for
actual
in
mock_request
.
call_args_list
:
self
.
assertEqual
(
expected
,
actual
)
def
test_accept_language
(
self
,
mock_request
):
lang
=
"eo"
text
=
"dummy content"
thread_id
=
"test_thread_id"
mock_request
.
side_effect
=
make_mock_request_impl
(
text
,
thread_id
)
self
.
client
.
get
(
reverse
(
"django_comment_client.forum.views.single_thread"
,
kwargs
=
{
"course_id"
:
self
.
course
.
id
,
"discussion_id"
:
"dummy"
,
"thread_id"
:
thread_id
,
}
),
HTTP_ACCEPT_LANGUAGE
=
lang
,
)
self
.
assert_all_calls_have_header
(
mock_request
,
"Accept-Language"
,
lang
)
@override_settings
(
COMMENTS_SERVICE_KEY
=
"test_api_key"
)
def
test_api_key
(
self
,
mock_request
):
mock_request
.
side_effect
=
make_mock_request_impl
(
"dummy"
,
"dummy"
)
...
...
lms/lib/comment_client/utils.py
View file @
1c188c9f
...
...
@@ -53,7 +53,10 @@ def request_timer(request_id, method, url):
def
perform_request
(
method
,
url
,
data_or_params
=
None
,
*
args
,
**
kwargs
):
if
data_or_params
is
None
:
data_or_params
=
{}
headers
=
{
'X-Edx-Api-Key'
:
getattr
(
settings
,
"COMMENTS_SERVICE_KEY"
,
None
)}
headers
=
{
'X-Edx-Api-Key'
:
getattr
(
settings
,
"COMMENTS_SERVICE_KEY"
,
None
),
'Accept-Language'
:
get_language
(),
}
request_id
=
uuid4
()
request_id_dict
=
{
'request_id'
:
request_id
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment