MIT: CCX. Fix issues identified in code review

Original Commit Messages:

use edx's own get_parent method, rather than our own.

add field to unique constraint to avoid MultipleObjectsReturned in case of multiple browser clicks on submit

fix 0011 migration, inherit from TimeStampedField and add composite index (migration only)

fix bug where adding an already registered user to a ccx would cause a crash due to an undefined variable

add assertNumQueries tests to test modules where override field providers are used

remove unnecessary teardown

implement recommended style for checking empty list

import utility methods rather than use duplicate code

added comment explaining date conversion to string for json

add logging for invalid users or emails when enrolling students

add comment about xmodule user state

avoid using get_or_create, which seems to be causing a race condition on schedule change save

relocate badly placed edvent handlers to fix multiple submit problem
This commit is contained in:
Carlos de la Guardia
2015-03-04 13:01:54 -06:00
committed by cewing
parent 3425424696
commit b3da2a54bb
13 changed files with 437 additions and 134 deletions

View File

@@ -242,6 +242,12 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
self.assertEqual(self.homework.due, extended)
self.assertEqual(self.assignment.due, extended)
def test_set_due_date_extension_num_queries(self):
extended = datetime.datetime(2013, 12, 25, 0, 0, tzinfo=utc)
with self.assertNumQueries(4):
tools.set_due_date_extension(self.course, self.week1, self.user, extended)
self._clear_field_data_cache()
def test_set_due_date_extension_invalid_date(self):
extended = datetime.datetime(2009, 1, 1, 0, 0, tzinfo=utc)
with self.assertRaises(tools.DashboardError):