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
1a398980
Commit
1a398980
authored
Jan 29, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for diango-comment-client middleware
parent
05354745
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
lms/djangoapps/django_comment_client/tests/test_middleware.py
+28
-0
No files found.
lms/djangoapps/django_comment_client/tests/test_middleware.py
0 → 100644
View file @
1a398980
import
string
import
random
import
collections
from
django.test
import
TestCase
import
comment_client
import
django.http
import
django_comment_client.middleware
as
middleware
class
AjaxExceptionTestCase
(
TestCase
):
# TODO: check whether the correct error message is produced.
# The error message should be the same as the argument to CommentClientError
def
setUp
(
self
):
self
.
a
=
middleware
.
AjaxExceptionMiddleware
()
self
.
request1
=
django
.
http
.
HttpRequest
()
self
.
request0
=
django
.
http
.
HttpRequest
()
self
.
exception1
=
comment_client
.
CommentClientError
(
'{}'
)
self
.
exception0
=
ValueError
()
self
.
request1
.
META
[
'HTTP_X_REQUESTED_WITH'
]
=
"XMLHttpRequest"
self
.
request0
.
META
[
'HTTP_X_REQUESTED_WITH'
]
=
"SHADOWFAX"
def
test_process_exception
(
self
):
self
.
assertIsInstance
(
self
.
a
.
process_exception
(
self
.
request1
,
self
.
exception1
),
middleware
.
JsonError
)
self
.
assertIsNone
(
self
.
a
.
process_exception
(
self
.
request1
,
self
.
exception0
))
self
.
assertIsNone
(
self
.
a
.
process_exception
(
self
.
request0
,
self
.
exception1
))
self
.
assertIsNone
(
self
.
a
.
process_exception
(
self
.
request0
,
self
.
exception0
))
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