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
3801f574
Commit
3801f574
authored
May 08, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in xqueue submission tests
parent
1d536256
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
41 deletions
+19
-41
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
+1
-1
common/lib/xmodule/xmodule/tests/__init__.py
+1
-1
common/lib/xmodule/xmodule/tests/mock_server.py
+0
-35
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+17
-4
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py
View file @
3801f574
...
...
@@ -243,7 +243,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
})
# Submit request. When successful, 'msg' is the prior length of the queue
(
error
,
msg
)
=
qinterface
.
send_to_queue
(
header
=
xheader
,
qinterface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
# State associated with the queueing request
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
3801f574
...
...
@@ -52,7 +52,7 @@ def test_system():
user
=
Mock
(
is_staff
=
False
),
filestore
=
Mock
(),
debug
=
True
,
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'testqueue'
,
'waittime'
:
10
},
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'testqueue'
,
'waittime'
:
10
,
'construct_callback'
:
Mock
(
side_effect
=
"/"
)
},
node_path
=
os
.
environ
.
get
(
"NODE_PATH"
,
"/usr/local/lib/node_modules"
),
xblock_model_data
=
lambda
descriptor
:
descriptor
.
_model_data
,
anonymous_student_id
=
'student'
,
...
...
common/lib/xmodule/xmodule/tests/mock_server.py
deleted
100644 → 0
View file @
1d536256
from
threading
import
Thread
import
socket
import
threading
import
SimpleHTTPServer
import
SocketServer
class
ThreadedRequestHandler
(
SimpleHTTPServer
.
SimpleHTTPRequestHandler
):
def
handle
(
self
):
data
=
self
.
request
.
recv
(
1024
)
cur_thread
=
threading
.
current_thread
()
response
=
"{}: {}"
.
format
(
cur_thread
.
name
,
data
)
self
.
request
.
sendall
(
response
)
return
class
ThreadedTCPServer
(
SocketServer
.
ThreadingMixIn
,
SocketServer
.
TCPServer
):
pass
def
create_server
(
host
,
port
):
"""
Mock a server to be used for the open ended grading tests
@param host: the hostname ie "localhost" or "127.0.0.1"
@param port: the integer of the port to open a connection on
@return: The created server object
"""
server
=
ThreadedTCPServer
((
host
,
port
),
ThreadedRequestHandler
)
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread
=
threading
.
Thread
(
target
=
server
.
serve_forever
)
# Exit the server thread when the main thread terminates
server_thread
.
daemon
=
True
server_thread
.
start
()
return
server
\ No newline at end of file
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
3801f574
...
...
@@ -8,6 +8,7 @@ from mock import patch
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingServiceError
from
xmodule.combined_open_ended_module
import
CombinedOpenEndedModule
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
Location
...
...
@@ -520,9 +521,11 @@ class OpenEndedModuleXmlTest(unittest.TestCase):
answer
=
"blah blah"
assessment
=
[
0
,
1
]
hint
=
"blah"
test_server
=
create_server
(
"127.0.0.1"
,
3034
)
def
setUp
(
self
):
self
.
test_system
=
test_system
()
self
.
test_system
.
xqueue
[
'interface'
]
=
Mock
(
send_to_queue
=
Mock
(
side_effect
=
[
1
,
"queued"
])
)
@staticmethod
def
get_import_system
(
load_error_modules
=
True
):
...
...
@@ -592,6 +595,16 @@ class OpenEndedModuleXmlTest(unittest.TestCase):
module
.
handle_ajax
(
"get_status"
,
{})
#Move to the next step in the problem
module
.
handle_ajax
(
"next_problem"
,
{})
module
.
get_html
()
module
.
handle_ajax
(
"get_combined_rubric"
,
{})
try
:
module
.
handle_ajax
(
"next_problem"
,
{})
except
GradingServiceError
:
#This error is okay. We don't have a grading service to connect to!
pass
#Move to the next step in the problem
try
:
module
.
get_html
()
except
GradingServiceError
:
#This error is okay. We don't have a grading service to connect to!
pass
module
.
handle_ajax
(
"get_combined_rubric"
,
{})
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