Add in ability to mock a server, a lot more testing code for open ended
This commit is contained in:
@@ -20,7 +20,7 @@ from xmodule.x_module import ModuleSystem
|
||||
from mock import Mock
|
||||
|
||||
open_ended_grading_interface = {
|
||||
'url': 'blah',
|
||||
'url': 'blah/',
|
||||
'username': 'incorrect_user',
|
||||
'password': 'incorrect_pass',
|
||||
'staff_grading' : 'staff_grading',
|
||||
|
||||
34
common/lib/xmodule/xmodule/tests/mock_server.py
Normal file
34
common/lib/xmodule/xmodule/tests/mock_server.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
This is a very very simple course, useful for debugging self assessment code.
|
||||
This is a very very simple course, useful for debugging open ended grading code.
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<combinedopenended attempts="10000" display_name = "Humanities Question -- Machine Assessed">
|
||||
<rubric>
|
||||
<rubric>
|
||||
<category>
|
||||
<description>Writing Applications</description>
|
||||
<option> The essay loses focus, has little information or supporting details, and the organization makes it difficult to follow.</option>
|
||||
<option> The essay presents a mostly unified theme, includes sufficient information to convey the theme, and is generally organized well.</option>
|
||||
</category>
|
||||
<category>
|
||||
<description> Language Conventions </description>
|
||||
<option> The essay demonstrates a reasonable command of proper spelling and grammar. </option>
|
||||
<option> The essay demonstrates superior command of proper spelling and grammar.</option>
|
||||
</category>
|
||||
</rubric>
|
||||
</rubric>
|
||||
<prompt>
|
||||
<h4>Censorship in the Libraries</h4>
|
||||
<p>"All of us can think of a book that we hope none of our children or any other children have taken off the shelf. But if I have the right to remove that book from the shelf -- that work I abhor -- then you also have exactly the same right and so does everyone else. And then we have no books left on the shelf for any of us." --Katherine Paterson, Author</p>
|
||||
<p>Write a persuasive essay to a newspaper reflecting your vies on censorship in libraries. Do you believe that certain materials, such as books, music, movies, magazines, etc., should be removed from the shelves if they are found offensive? Support your position with convincing arguments from your own experience, observations, and/or reading.</p>
|
||||
</prompt>
|
||||
<task>
|
||||
<selfassessment/>
|
||||
</task>
|
||||
<task>
|
||||
<openended min_score_to_attempt="2" max_score_to_attempt="3">
|
||||
<openendedparam>
|
||||
<initial_display>Enter essay here.</initial_display>
|
||||
<answer_display>This is the answer.</answer_display>
|
||||
<grader_payload>{"grader_settings" : "ml_grading.conf", "problem_id" : "6.002x/Welcome/OETest"}</grader_payload>
|
||||
</openendedparam>
|
||||
</openended>
|
||||
</task>
|
||||
</combinedopenended>
|
||||
@@ -1 +1 @@
|
||||
<course org="edX" course="sa_test" url_name="2012_Fall"/>
|
||||
<course org="edX" course="oe_test" url_name="2012_Fall"/>
|
||||
|
||||
Reference in New Issue
Block a user