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
ec1b056d
Commit
ec1b056d
authored
Mar 26, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use requests library utility method for getting json results
parent
cb93b665
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
19 deletions
+11
-19
lms/djangoapps/django_comment_client/base/tests.py
+0
-0
lms/djangoapps/django_comment_client/forum/tests.py
+10
-18
lms/lib/comment_client/utils.py
+1
-1
No files found.
lms/djangoapps/django_comment_client/base/tests.py
View file @
ec1b056d
This diff is collapsed.
Click to expand it.
lms/djangoapps/django_comment_client/forum/tests.py
View file @
ec1b056d
...
@@ -109,26 +109,18 @@ def make_mock_request_impl(text, thread_id=None):
...
@@ -109,26 +109,18 @@ def make_mock_request_impl(text, thread_id=None):
def
mock_request_impl
(
*
args
,
**
kwargs
):
def
mock_request_impl
(
*
args
,
**
kwargs
):
url
=
args
[
1
]
url
=
args
[
1
]
if
url
.
endswith
(
"threads"
):
if
url
.
endswith
(
"threads"
):
return
Mock
(
data
=
{
status_code
=
200
,
"collection"
:
[
make_mock_thread_data
(
text
,
"dummy_thread_id"
,
False
)]
text
=
json
.
dumps
({
}
"collection"
:
[
make_mock_thread_data
(
text
,
"dummy_thread_id"
,
False
)]
})
)
elif
thread_id
and
url
.
endswith
(
thread_id
):
elif
thread_id
and
url
.
endswith
(
thread_id
):
return
Mock
(
data
=
make_mock_thread_data
(
text
,
thread_id
,
True
)
status_code
=
200
,
text
=
json
.
dumps
(
make_mock_thread_data
(
text
,
thread_id
,
True
))
)
else
:
# user query
else
:
# user query
return
Mock
(
data
=
{
status_code
=
200
,
"upvoted_ids"
:
[],
text
=
json
.
dumps
({
"downvoted_ids"
:
[],
"upvoted_ids"
:
[],
"subscribed_thread_ids"
:
[],
"downvoted_ids"
:
[],
}
"subscribed_thread_ids"
:
[],
return
Mock
(
status_code
=
200
,
text
=
json
.
dumps
(
data
),
json
=
Mock
(
return_value
=
data
))
})
)
return
mock_request_impl
return
mock_request_impl
...
...
lms/lib/comment_client/utils.py
View file @
ec1b056d
...
@@ -87,7 +87,7 @@ def perform_request(method, url, data_or_params=None, raw=False):
...
@@ -87,7 +87,7 @@ def perform_request(method, url, data_or_params=None, raw=False):
if
raw
:
if
raw
:
return
response
.
text
return
response
.
text
else
:
else
:
return
json
.
loads
(
response
.
text
)
return
response
.
json
(
)
class
CommentClientError
(
Exception
):
class
CommentClientError
(
Exception
):
...
...
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