Commit 4bb341c8 by Matt Drayer Committed by Jonathan Piacenti

mattdrayer/fix_broken_tests: Updated stale dates throughout test suite

parent ac3c0438
...@@ -1736,7 +1736,7 @@ class CoursesApiTests(ModuleStoreTestCase): ...@@ -1736,7 +1736,7 @@ class CoursesApiTests(ModuleStoreTestCase):
number='4033', number='4033',
name='leaders_by_completions', name='leaders_by_completions',
start=datetime(2014, 9, 16, 14, 30), start=datetime(2014, 9, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
chapter = ItemFactory.create( chapter = ItemFactory.create(
......
...@@ -23,7 +23,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase): ...@@ -23,7 +23,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
self.test_data = '<html>{}</html>'.format(str(uuid.uuid4())) self.test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
...@@ -43,7 +43,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase): ...@@ -43,7 +43,7 @@ class MigrateCourseIdsTests(ModuleStoreTestCase):
self.course2 = CourseFactory.create( self.course2 = CourseFactory.create(
org='TEST', org='TEST',
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
self.chapter2 = ItemFactory.create( self.chapter2 = ItemFactory.create(
category="chapter", category="chapter",
......
...@@ -23,7 +23,7 @@ class ApiManagerReceiversTests(ModuleStoreTestCase): ...@@ -23,7 +23,7 @@ class ApiManagerReceiversTests(ModuleStoreTestCase):
# Create a course to work with # Create a course to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
test_data = '<html>{}</html>'.format(str(uuid.uuid4())) test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -1628,7 +1628,7 @@ class UsersApiTests(ModuleStoreTestCase): ...@@ -1628,7 +1628,7 @@ class UsersApiTests(ModuleStoreTestCase):
course2 = CourseFactory.create( course2 = CourseFactory.create(
display_name="TEST COURSE2", display_name="TEST COURSE2",
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30), end=datetime(2020, 1, 16, 14, 30),
org='TURLG', org='TURLG',
run='TURLG1' run='TURLG1'
) )
...@@ -1636,7 +1636,7 @@ class UsersApiTests(ModuleStoreTestCase): ...@@ -1636,7 +1636,7 @@ class UsersApiTests(ModuleStoreTestCase):
course3 = CourseFactory.create( course3 = CourseFactory.create(
display_name="TEST COURSE3", display_name="TEST COURSE3",
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30), end=datetime(2020, 1, 16, 14, 30),
org='TURLG2', org='TURLG2',
run='TURLG2' run='TURLG2'
) )
...@@ -1717,7 +1717,7 @@ class UsersApiTests(ModuleStoreTestCase): ...@@ -1717,7 +1717,7 @@ class UsersApiTests(ModuleStoreTestCase):
course2 = CourseFactory.create( course2 = CourseFactory.create(
display_name="TEST COURSE2", display_name="TEST COURSE2",
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30), end=datetime(2020, 1, 16, 14, 30),
org='TURLP2', org='TURLP2',
run='TURLP2' run='TURLP2'
) )
...@@ -1728,7 +1728,7 @@ class UsersApiTests(ModuleStoreTestCase): ...@@ -1728,7 +1728,7 @@ class UsersApiTests(ModuleStoreTestCase):
course3 = CourseFactory.create( course3 = CourseFactory.create(
display_name="TEST COURSE3", display_name="TEST COURSE3",
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30), end=datetime(2020, 1, 16, 14, 30),
org='TURLP3', org='TURLP3',
run='TURLP3' run='TURLP3'
) )
...@@ -1739,7 +1739,7 @@ class UsersApiTests(ModuleStoreTestCase): ...@@ -1739,7 +1739,7 @@ class UsersApiTests(ModuleStoreTestCase):
course4 = CourseFactory.create( course4 = CourseFactory.create(
display_name="COURSE4 NO MODERATOR", display_name="COURSE4 NO MODERATOR",
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30), end=datetime(2020, 1, 16, 14, 30),
org='TURLP4', org='TURLP4',
run='TURLP4' run='TURLP4'
) )
......
...@@ -37,7 +37,7 @@ class DeleteCourseReferencesTests(TestCase): ...@@ -37,7 +37,7 @@ class DeleteCourseReferencesTests(TestCase):
# Create a course to work with # Create a course to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
test_data = '<html>{}</html>'.format(str(uuid.uuid4())) test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -3,7 +3,7 @@ Run these tests @ Devstack: ...@@ -3,7 +3,7 @@ Run these tests @ Devstack:
rake fasttest_lms[common/djangoapps/api_manager/management/commands/tests/test_migrate_orgdata.py] rake fasttest_lms[common/djangoapps/api_manager/management/commands/tests/test_migrate_orgdata.py]
""" """
from datetime import datetime from datetime import datetime
from mock import MagicMock from mock import MagicMock, patch
import uuid import uuid
from django.conf import settings from django.conf import settings
...@@ -31,7 +31,8 @@ class GenerateGradebookEntriesTests(ModuleStoreTestCase): ...@@ -31,7 +31,8 @@ class GenerateGradebookEntriesTests(ModuleStoreTestCase):
# Create a couple courses to work with # Create a couple courses to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16),
org='GRADEBOOK'
) )
self.test_data = '<html>{}</html>'.format(str(uuid.uuid4())) self.test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
...@@ -131,6 +132,10 @@ class GenerateGradebookEntriesTests(ModuleStoreTestCase): ...@@ -131,6 +132,10 @@ class GenerateGradebookEntriesTests(ModuleStoreTestCase):
course.id course.id
)._xmodule )._xmodule
@patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_generate_gradebook_entries(self): def test_generate_gradebook_entries(self):
""" """
Test the gradebook entry generator Test the gradebook entry generator
......
...@@ -122,6 +122,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -122,6 +122,10 @@ class GradebookTests(ModuleStoreTestCase):
metadata={'rerandomize': 'always', 'graded': True, 'format': "Final Exam"} metadata={'rerandomize': 'always', 'graded': True, 'format': "Final Exam"}
) )
@patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_receiver_on_score_changed(self): def test_receiver_on_score_changed(self):
self._create_course() self._create_course()
module = self.get_module_for_user(self.user, self.course, self.problem) module = self.get_module_for_user(self.user, self.course, self.problem)
...@@ -150,7 +154,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -150,7 +154,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 5) self.assertEqual(len(history), 5)
@patch.dict(settings.FEATURES, {'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False}) @patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_open_course(self): def test_open_course(self):
self._create_course(start=datetime(2010,1,1, tzinfo=UTC()), end=datetime(3000, 1, 1, tzinfo=UTC())) self._create_course(start=datetime(2010,1,1, tzinfo=UTC()), end=datetime(3000, 1, 1, tzinfo=UTC()))
...@@ -168,7 +175,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -168,7 +175,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 2) self.assertEqual(len(history), 2)
@patch.dict(settings.FEATURES, {'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False}) @patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_not_yet_started_course(self): def test_not_yet_started_course(self):
self._create_course(start=datetime(3000,1,1, tzinfo=UTC()), end=datetime(3000, 1, 1, tzinfo=UTC())) self._create_course(start=datetime(3000,1,1, tzinfo=UTC()), end=datetime(3000, 1, 1, tzinfo=UTC()))
...@@ -186,7 +196,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -186,7 +196,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 2) self.assertEqual(len(history), 2)
@patch.dict(settings.FEATURES, {'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False}) @patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_closed_course_student(self): def test_closed_course_student(self):
self._create_course(start=datetime(2010,1,1, tzinfo=UTC()), end=datetime(2011, 1, 1, tzinfo=UTC())) self._create_course(start=datetime(2010,1,1, tzinfo=UTC()), end=datetime(2011, 1, 1, tzinfo=UTC()))
...@@ -204,7 +217,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -204,7 +217,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 0) self.assertEqual(len(history), 0)
@patch.dict(settings.FEATURES, {'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False}) @patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_closed_course_admin(self): def test_closed_course_admin(self):
""" """
Users marked as Admin should be able to submit grade events to a closed course Users marked as Admin should be able to submit grade events to a closed course
...@@ -226,7 +242,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -226,7 +242,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 0) self.assertEqual(len(history), 0)
@patch.dict(settings.FEATURES, {'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False}) @patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_closed_course_staff(self): def test_closed_course_staff(self):
""" """
Users marked as course staff should be able to submit grade events to a closed course Users marked as course staff should be able to submit grade events to a closed course
...@@ -248,6 +267,10 @@ class GradebookTests(ModuleStoreTestCase): ...@@ -248,6 +267,10 @@ class GradebookTests(ModuleStoreTestCase):
history = StudentGradebookHistory.objects.all() history = StudentGradebookHistory.objects.all()
self.assertEqual(len(history), 0) self.assertEqual(len(history), 0)
@patch.dict(settings.FEATURES, {
'ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE': False,
'SIGNAL_ON_SCORE_CHANGED': True
})
def test_receiver_on_course_deleted(self): def test_receiver_on_course_deleted(self):
self._create_course(start=datetime(2010, 1, 1, tzinfo=UTC()), end=datetime(2020, 1, 1, tzinfo=UTC())) self._create_course(start=datetime(2010, 1, 1, tzinfo=UTC()), end=datetime(2020, 1, 1, tzinfo=UTC()))
module = self.get_module_for_user(self.user, self.course, self.problem) module = self.get_module_for_user(self.user, self.course, self.problem)
......
...@@ -26,7 +26,7 @@ class InstructorReceiversTests(TestCase): ...@@ -26,7 +26,7 @@ class InstructorReceiversTests(TestCase):
# Create a course to work with # Create a course to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
test_data = '<html>{}</html>'.format(str(uuid.uuid4())) test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -28,7 +28,7 @@ class GenerateProgressEntriesTests(ModuleStoreTestCase): ...@@ -28,7 +28,7 @@ class GenerateProgressEntriesTests(ModuleStoreTestCase):
# Create a couple courses to work with # Create a couple courses to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
self.test_data = '<html>{}</html>'.format(str(uuid.uuid4())) self.test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -26,7 +26,7 @@ class MigrateCourseIdsTests(TestCase): ...@@ -26,7 +26,7 @@ class MigrateCourseIdsTests(TestCase):
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
self.test_data = '<html>{}</html>'.format(str(uuid.uuid4())) self.test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
...@@ -46,7 +46,7 @@ class MigrateCourseIdsTests(TestCase): ...@@ -46,7 +46,7 @@ class MigrateCourseIdsTests(TestCase):
self.course2 = CourseFactory.create( self.course2 = CourseFactory.create(
org='TEST', org='TEST',
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
self.chapter2 = ItemFactory.create( self.chapter2 = ItemFactory.create(
category="chapter", category="chapter",
......
...@@ -23,7 +23,7 @@ class ProjectsReceiversTests(ModuleStoreTestCase): ...@@ -23,7 +23,7 @@ class ProjectsReceiversTests(ModuleStoreTestCase):
# Create a course to work with # Create a course to work with
self.course = CourseFactory.create( self.course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16) end=datetime(2020, 1, 16)
) )
test_data = '<html>{}</html>'.format(str(uuid.uuid4())) test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -62,7 +62,7 @@ class WorkgroupsApiTests(ModuleStoreTestCase): ...@@ -62,7 +62,7 @@ class WorkgroupsApiTests(ModuleStoreTestCase):
self.test_course = CourseFactory.create( self.test_course = CourseFactory.create(
start=datetime(2014, 6, 16, 14, 30), start=datetime(2014, 6, 16, 14, 30),
end=datetime(2015, 1, 16, 14, 30) end=datetime(2020, 1, 16, 14, 30)
) )
self.test_data = '<html>{}</html>'.format(str(uuid.uuid4())) self.test_data = '<html>{}</html>'.format(str(uuid.uuid4()))
......
...@@ -1950,7 +1950,7 @@ INSTALLED_APPS = ( ...@@ -1950,7 +1950,7 @@ INSTALLED_APPS = (
'teams', 'teams',
'xblock_django', 'xblock_django',
# EDX API application # EDX API application
'api_manager', 'api_manager',
) )
...@@ -2413,6 +2413,10 @@ OPTIONAL_APPS = ( ...@@ -2413,6 +2413,10 @@ OPTIONAL_APPS = (
# milestones # milestones
'milestones', 'milestones',
# mckinsey apps
'gradebook',
) )
for app_name in OPTIONAL_APPS: for app_name in OPTIONAL_APPS:
......
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