Commit b63aae22 by Jay Zoldak

small pep8 pylint and superclass fixes

parent 5bf839c9
...@@ -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):
......
...@@ -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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment