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
b63aae22
Commit
b63aae22
authored
Mar 29, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small pep8 pylint and superclass fixes
parent
5bf839c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
cms/djangoapps/contentstore/tests/utils.py
+4
-4
lms/djangoapps/courseware/mock_xqueue_server/test_mock_xqueue_server.py
+8
-9
lms/djangoapps/courseware/tests/tests.py
+0
-0
No files found.
cms/djangoapps/contentstore/tests/utils.py
View file @
b63aae22
...
@@ -32,7 +32,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -32,7 +32,7 @@ class ModuleStoreTestCase(TestCase):
# This query means: every item in the collection
# This query means: every item in the collection
# that is not a template
# that is not a template
query
=
{
"_id.course"
:
{
"$ne"
:
"templates"
}}
query
=
{
"_id.course"
:
{
"$ne"
:
"templates"
}}
# Remove everything except templates
# Remove everything except templates
modulestore
.
collection
.
remove
(
query
)
modulestore
.
collection
.
remove
(
query
)
...
@@ -47,7 +47,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -47,7 +47,7 @@ class ModuleStoreTestCase(TestCase):
modulestore
=
xmodule
.
modulestore
.
django
.
modulestore
()
modulestore
=
xmodule
.
modulestore
.
django
.
modulestore
()
# Count the number of templates
# Count the number of templates
query
=
{
"_id.course"
:
"templates"
}
query
=
{
"_id.course"
:
"templates"
}
num_templates
=
modulestore
.
collection
.
find
(
query
)
.
count
()
num_templates
=
modulestore
.
collection
.
find
(
query
)
.
count
()
if
num_templates
<
1
:
if
num_templates
<
1
:
...
@@ -96,7 +96,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -96,7 +96,7 @@ class ModuleStoreTestCase(TestCase):
ModuleStoreTestCase
.
load_templates_if_necessary
()
ModuleStoreTestCase
.
load_templates_if_necessary
()
# Call superclass implementation
# Call superclass implementation
TestCase
.
_pre_setup
(
self
)
super
(
ModuleStoreTestCase
,
self
)
.
_pre_setup
(
)
def
_post_teardown
(
self
):
def
_post_teardown
(
self
):
'''
'''
...
@@ -106,7 +106,7 @@ class ModuleStoreTestCase(TestCase):
...
@@ -106,7 +106,7 @@ class ModuleStoreTestCase(TestCase):
ModuleStoreTestCase
.
flush_mongo_except_templates
()
ModuleStoreTestCase
.
flush_mongo_except_templates
()
# Call superclass implementation
# Call superclass implementation
TestCase
.
_post_teardown
(
self
)
super
(
ModuleStoreTestCase
,
self
)
.
_post_teardown
(
)
def
parse_json
(
response
):
def
parse_json
(
response
):
...
...
lms/djangoapps/courseware/mock_xqueue_server/test_mock_xqueue_server.py
View file @
b63aae22
...
@@ -3,7 +3,6 @@ import unittest
...
@@ -3,7 +3,6 @@ import unittest
import
threading
import
threading
import
json
import
json
import
urllib
import
urllib
import
urlparse
import
time
import
time
from
mock_xqueue_server
import
MockXQueueServer
,
MockXQueueRequestHandler
from
mock_xqueue_server
import
MockXQueueServer
,
MockXQueueRequestHandler
...
@@ -33,7 +32,7 @@ class MockXQueueServerTest(unittest.TestCase):
...
@@ -33,7 +32,7 @@ class MockXQueueServerTest(unittest.TestCase):
server_port
=
8034
server_port
=
8034
self
.
server_url
=
'http://127.0.0.1:
%
d'
%
server_port
self
.
server_url
=
'http://127.0.0.1:
%
d'
%
server_port
self
.
server
=
MockXQueueServer
(
server_port
,
self
.
server
=
MockXQueueServer
(
server_port
,
{
'correct'
:
True
,
'score'
:
1
,
'msg'
:
''
})
{
'correct'
:
True
,
'score'
:
1
,
'msg'
:
''
})
# Start the server in a separate daemon thread
# Start the server in a separate daemon thread
server_thread
=
threading
.
Thread
(
target
=
self
.
server
.
serve_forever
)
server_thread
=
threading
.
Thread
(
target
=
self
.
server
.
serve_forever
)
...
@@ -55,18 +54,18 @@ class MockXQueueServerTest(unittest.TestCase):
...
@@ -55,18 +54,18 @@ class MockXQueueServerTest(unittest.TestCase):
callback_url
=
'http://127.0.0.1:8000/test_callback'
callback_url
=
'http://127.0.0.1:8000/test_callback'
grade_header
=
json
.
dumps
({
'lms_callback_url'
:
callback_url
,
grade_header
=
json
.
dumps
({
'lms_callback_url'
:
callback_url
,
'lms_key'
:
'test_queuekey'
,
'lms_key'
:
'test_queuekey'
,
'queue_name'
:
'test_queue'
})
'queue_name'
:
'test_queue'
})
grade_body
=
json
.
dumps
({
'student_info'
:
'test'
,
grade_body
=
json
.
dumps
({
'student_info'
:
'test'
,
'grader_payload'
:
'test'
,
'grader_payload'
:
'test'
,
'student_response'
:
'test'
})
'student_response'
:
'test'
})
grade_request
=
{
'xqueue_header'
:
grade_header
,
grade_request
=
{
'xqueue_header'
:
grade_header
,
'xqueue_body'
:
grade_body
}
'xqueue_body'
:
grade_body
}
response_handle
=
urllib
.
urlopen
(
self
.
server_url
+
'/xqueue/submit'
,
response_handle
=
urllib
.
urlopen
(
self
.
server_url
+
'/xqueue/submit'
,
urllib
.
urlencode
(
grade_request
))
urllib
.
urlencode
(
grade_request
))
response_dict
=
json
.
loads
(
response_handle
.
read
())
response_dict
=
json
.
loads
(
response_handle
.
read
())
...
@@ -78,8 +77,8 @@ class MockXQueueServerTest(unittest.TestCase):
...
@@ -78,8 +77,8 @@ class MockXQueueServerTest(unittest.TestCase):
# Expect that the server tries to post back the grading info
# Expect that the server tries to post back the grading info
xqueue_body
=
json
.
dumps
({
'correct'
:
True
,
'score'
:
1
,
xqueue_body
=
json
.
dumps
({
'correct'
:
True
,
'score'
:
1
,
'msg'
:
'<div></div>'
})
'msg'
:
'<div></div>'
})
expected_callback_dict
=
{
'xqueue_header'
:
grade_header
,
expected_callback_dict
=
{
'xqueue_header'
:
grade_header
,
'xqueue_body'
:
xqueue_body
}
'xqueue_body'
:
xqueue_body
}
MockXQueueRequestHandler
.
post_to_url
.
assert_called_with
(
callback_url
,
MockXQueueRequestHandler
.
post_to_url
.
assert_called_with
(
callback_url
,
expected_callback_dict
)
expected_callback_dict
)
lms/djangoapps/courseware/tests/tests.py
View file @
b63aae22
This diff is collapsed.
Click to expand it.
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