'Check that enrollment periods work.'

@patch.dict('courseware.access.settings.FEATURES', {'DISABLE_START_DATES': False})
def test_enrollment_period(self):

    now = datetime.datetime.now(pytz.UTC)
    tomorrow = (now + datetime.timedelta(days=1))
    nextday = (tomorrow + datetime.timedelta(days=1))
    yesterday = (now - datetime.timedelta(days=1))
    self.course.enrollment_start = tomorrow
    self.course.enrollment_end = nextday
    self.test_course.enrollment_start = yesterday
    self.test_course.enrollment_end = tomorrow
    self.course = self.update_course(self.course, self.user.id)
    self.test_course = self.update_course(self.test_course, self.user.id)
    self.login(self.unenrolled_user)
    self.assertFalse(self.enroll(self.course))
    self.assertTrue(self.enroll(self.test_course))
    self.logout()
    self.login(self.instructor_user)
    self.assertTrue(self.enroll(self.course))
    self.logout()
    self.login(self.global_staff_user)
    self.assertTrue(self.enroll(self.course))
