def test_creation_auth_on(self): BulkEmailFlag.objects.create(enabled=True, require_course_email_auth=True) course_id = CourseKey.from_string('abc/123/doremi') # Test that course is not authorized by default self.assertFalse(BulkEmailFlag.feature_enabled(course_id)) # Authorize cauth = CourseAuthorization(course_id=course_id, email_enabled=True) cauth.save() # Now, course should be authorized self.assertTrue(BulkEmailFlag.feature_enabled(course_id)) self.assertEqual( cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Enabled" ) # Unauthorize by explicitly setting email_enabled to False cauth.email_enabled = False cauth.save() # Test that course is now unauthorized self.assertFalse(BulkEmailFlag.feature_enabled(course_id)) self.assertEqual( cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Not Enabled" )
def test_creation_auth_on(self): BulkEmailFlag.objects.create(enabled=True, require_course_email_auth=True) course_id = CourseKey.from_string('abc/123/doremi') # Test that course is not authorized by default self.assertFalse(BulkEmailFlag.feature_enabled(course_id)) # Authorize cauth = CourseAuthorization(course_id=course_id, email_enabled=True) cauth.save() # Now, course should be authorized self.assertTrue(BulkEmailFlag.feature_enabled(course_id)) self.assertEqual( cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Enabled" ) # Unauthorize by explicitly setting email_enabled to False cauth.email_enabled = False cauth.save() # Test that course is now unauthorized self.assertFalse(BulkEmailFlag.feature_enabled(course_id)) self.assertEqual( cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Not Enabled" )
def test_creation_auth_on(self): course_id = SlashSeparatedCourseKey("abc", "123", "doremi") # Test that course is not authorized by default self.assertFalse(CourseAuthorization.instructor_email_enabled(course_id)) # Authorize cauth = CourseAuthorization(course_id=course_id, email_enabled=True) cauth.save() # Now, course should be authorized self.assertTrue(CourseAuthorization.instructor_email_enabled(course_id)) self.assertEquals(cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Enabled") # Unauthorize by explicitly setting email_enabled to False cauth.email_enabled = False cauth.save() # Test that course is now unauthorized self.assertFalse(CourseAuthorization.instructor_email_enabled(course_id)) self.assertEquals(cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Not Enabled")
def test_creation_auth_on(self): course_id = SlashSeparatedCourseKey('abc', '123', 'doremi') # Test that course is not authorized by default self.assertFalse( CourseAuthorization.instructor_email_enabled(course_id)) # Authorize cauth = CourseAuthorization(course_id=course_id, email_enabled=True) cauth.save() # Now, course should be authorized self.assertTrue( CourseAuthorization.instructor_email_enabled(course_id)) self.assertEquals(cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Enabled") # Unauthorize by explicitly setting email_enabled to False cauth.email_enabled = False cauth.save() # Test that course is now unauthorized self.assertFalse( CourseAuthorization.instructor_email_enabled(course_id)) self.assertEquals( cauth.__unicode__(), "Course 'abc/123/doremi': Instructor Email Not Enabled")