def test_celebration_created(self): """ Test that we make celebration objects when enrollments are created """ self.assertEqual(CourseEnrollmentCelebration.objects.count(), 0) # Test initial creation upon an enrollment being made enrollment = CourseEnrollmentFactory() self.assertEqual(CourseEnrollmentCelebration.objects.count(), 1) celebration = CourseEnrollmentCelebration.objects.get(enrollment=enrollment, celebrate_first_section=True) # Test nothing changes if we update that enrollment celebration.celebrate_first_section = False celebration.save() enrollment.mode = 'test-mode' enrollment.save() self.assertEqual(CourseEnrollmentCelebration.objects.count(), 1) CourseEnrollmentCelebration.objects.get(enrollment=enrollment, celebrate_first_section=False)