Commit 176d6a76 by Matt Drayer

mattdrayer/fix_broken_tests: Updated stale dates throughout test suite

parent dabaaa76
...@@ -1740,7 +1740,7 @@ class CoursesApiTests(TestCase): ...@@ -1740,7 +1740,7 @@ class CoursesApiTests(TestCase):
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(
......
...@@ -27,7 +27,7 @@ class MigrateCourseIdsTests(TestCase): ...@@ -27,7 +27,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()))
...@@ -47,7 +47,7 @@ class MigrateCourseIdsTests(TestCase): ...@@ -47,7 +47,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",
......
...@@ -26,7 +26,7 @@ class ApiManagerReceiversTests(TestCase): ...@@ -26,7 +26,7 @@ class ApiManagerReceiversTests(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()))
......
...@@ -1631,7 +1631,7 @@ class UsersApiTests(TestCase): ...@@ -1631,7 +1631,7 @@ class UsersApiTests(TestCase):
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'
) )
...@@ -1639,7 +1639,7 @@ class UsersApiTests(TestCase): ...@@ -1639,7 +1639,7 @@ class UsersApiTests(TestCase):
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'
) )
...@@ -1720,7 +1720,7 @@ class UsersApiTests(TestCase): ...@@ -1720,7 +1720,7 @@ class UsersApiTests(TestCase):
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'
) )
...@@ -1731,7 +1731,7 @@ class UsersApiTests(TestCase): ...@@ -1731,7 +1731,7 @@ class UsersApiTests(TestCase):
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'
) )
...@@ -1742,7 +1742,7 @@ class UsersApiTests(TestCase): ...@@ -1742,7 +1742,7 @@ class UsersApiTests(TestCase):
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
...@@ -34,7 +34,8 @@ class GenerateGradebookEntriesTests(TestCase): ...@@ -34,7 +34,8 @@ class GenerateGradebookEntriesTests(TestCase):
# 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()))
...@@ -134,6 +135,10 @@ class GenerateGradebookEntriesTests(TestCase): ...@@ -134,6 +135,10 @@ class GenerateGradebookEntriesTests(TestCase):
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
......
...@@ -124,6 +124,10 @@ class GradebookTests(TestCase): ...@@ -124,6 +124,10 @@ class GradebookTests(TestCase):
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)
...@@ -152,7 +156,10 @@ class GradebookTests(TestCase): ...@@ -152,7 +156,10 @@ class GradebookTests(TestCase):
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()))
...@@ -170,7 +177,10 @@ class GradebookTests(TestCase): ...@@ -170,7 +177,10 @@ class GradebookTests(TestCase):
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()))
...@@ -188,7 +198,10 @@ class GradebookTests(TestCase): ...@@ -188,7 +198,10 @@ class GradebookTests(TestCase):
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()))
...@@ -206,7 +219,10 @@ class GradebookTests(TestCase): ...@@ -206,7 +219,10 @@ class GradebookTests(TestCase):
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
...@@ -228,7 +244,10 @@ class GradebookTests(TestCase): ...@@ -228,7 +244,10 @@ class GradebookTests(TestCase):
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
...@@ -250,6 +269,10 @@ class GradebookTests(TestCase): ...@@ -250,6 +269,10 @@ class GradebookTests(TestCase):
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()))
......
...@@ -31,7 +31,7 @@ class GenerateProgressEntriesTests(TestCase): ...@@ -31,7 +31,7 @@ class GenerateProgressEntriesTests(TestCase):
# 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",
......
...@@ -26,7 +26,7 @@ class ProjectsReceiversTests(TestCase): ...@@ -26,7 +26,7 @@ class ProjectsReceiversTests(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()))
......
...@@ -62,7 +62,7 @@ class WorkgroupsApiTests(TestCase): ...@@ -62,7 +62,7 @@ class WorkgroupsApiTests(TestCase):
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()))
......
...@@ -1419,7 +1419,7 @@ INSTALLED_APPS = ( ...@@ -1419,7 +1419,7 @@ INSTALLED_APPS = (
# Country list # Country list
'django_countries', 'django_countries',
# EDX API application # EDX API application
'api_manager', 'api_manager',
) )
...@@ -1756,7 +1756,10 @@ OPTIONAL_APPS = ( ...@@ -1756,7 +1756,10 @@ OPTIONAL_APPS = (
'openassessment.assessment', 'openassessment.assessment',
'openassessment.fileupload', 'openassessment.fileupload',
'openassessment.workflow', 'openassessment.workflow',
'openassessment.xblock' 'openassessment.xblock',
# 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