Fixed broken tests. Made the hint manager enabled in testing environments - this lets us test the hint manager.

This commit is contained in:
Felix Sun
2013-06-27 10:23:12 -04:00
committed by Carlos Andrés Rocha
parent bc2cab2fda
commit 4071a57f68
5 changed files with 9 additions and 6 deletions

View File

@@ -203,7 +203,7 @@ class CrowdsourceHinterModule(CrowdsourceHinterFields, XModule):
if answer in self.hints:
# Go through each hint, and add to index_to_hints
for hint_id in hints_offered:
if hint_id is None:
if hint_id is not None:
try:
index_to_hints[i].append((self.hints[answer][str(hint_id)][0], hint_id))
except KeyError:

View File

@@ -207,6 +207,7 @@ class CrowdsourceHinterTest(unittest.TestCase):
)
json_in = {'problem_name': '42.5'}
out = m.get_feedback(json_in)
print out['index_to_hints']
self.assertTrue(len(out['index_to_hints'][0])==2)

View File

@@ -50,13 +50,13 @@ class HintManagerTest(ModuleStoreTestCase):
Set up mako middleware, which is necessary for template rendering to happen.
"""
course = CourseFactory.create(org='Me', number='19.002', display_name='test_course')
# mitxmako.middleware.MakoMiddleware()
def test_student_block(self):
"""
Makes sure that students cannot see the hint management view.
"""
nose.tools.set_trace()
c = Client()
user = UserFactory.create(username='robot', email='robot@edx.org', password='test')
c.login(username='robot', password='test')

View File

@@ -27,6 +27,8 @@ MITX_FEATURES['ENABLE_DISCUSSION_SERVICE'] = False
MITX_FEATURES['ENABLE_SERVICE_STATUS'] = True
MITX_FEATURES['ENABLE_HINTER_INSTRUCTOR_VIEW'] = True
# Need wiki for courseware views to work. TODO (vshnayder): shouldn't need it.
WIKI_ENABLED = True

View File

@@ -15,7 +15,7 @@
function setup() {
field = $("#field-label").html()
changed_votes = []
$(".votes").live('input', function() {
$(".votes").on('input', function() {
changed_votes.push($(this))
});
@@ -43,9 +43,9 @@
'field': field}
for (var i=0; i<changed_votes.length; i++) {
data_dict[i] = [$(changed_votes[i]).parent().attr("data-problem"),
$(changed_votes[i]).parent().attr("data-answer"),
$(changed_votes[i]).parent().attr("data-pk"),
$(changed_votes[i]).val()];
$(changed_votes[i]).parent().attr("data-answer"),
$(changed_votes[i]).parent().attr("data-pk"),
$(changed_votes[i]).val()];
}
$.ajax(window.location.pathname, {
type: "POST",