def test_skip_verification(self): """ Test adding skip attempt of a user for a reverification checkpoint. """ reverification_service = ReverificationService() VerificationCheckpoint.objects.create( course_id=unicode(self.course_id), checkpoint_location=self.final_checkpoint_location ) reverification_service.skip_verification(self.user.id, unicode(self.course_id), self.final_checkpoint_location) self.assertEqual( SkippedReverification.objects.filter(user=self.user, course_id=self.course_id).count(), 1 ) # now test that a user can have only one entry for a skipped # reverification for a course reverification_service.skip_verification(self.user.id, unicode(self.course_id), self.final_checkpoint_location) self.assertEqual( SkippedReverification.objects.filter(user=self.user, course_id=self.course_id).count(), 1 ) # testing service for skipped attempt. self.assertEqual( reverification_service.get_status(self.user.id, unicode(self.course_id), self.final_checkpoint_location), 'skipped' )
def test_declined_verification_on_skip(self): """Test that status with value 'declined' is added in credit requirement status model when a user skip's an ICRV. """ reverification_service = ReverificationService() checkpoint = VerificationCheckpoint.objects.create( course_id=unicode(self.course_id), checkpoint_location=self.final_checkpoint_location) # Create credit course and set credit requirements. CreditCourse.objects.create(course_key=self.course_key, enabled=True) set_credit_requirements(self.course_key, [{ "namespace": "reverification", "name": checkpoint.checkpoint_location, "display_name": "Assessment 1", "criteria": {}, }]) reverification_service.skip_verification( self.user.id, unicode(self.course_id), self.final_checkpoint_location) requirement_status = get_credit_requirement_status( self.course_key, self.user.username, 'reverification', checkpoint.checkpoint_location) self.assertEqual( SkippedReverification.objects.filter( user=self.user, course_id=self.course_id).count(), 1) self.assertEqual(len(requirement_status), 1) self.assertEqual(requirement_status[0].get('name'), checkpoint.checkpoint_location) self.assertEqual(requirement_status[0].get('status'), 'declined')
def test_declined_verification_on_skip(self): """Test that status with value 'declined' is added in credit requirement status model when a user skip's an ICRV. """ reverification_service = ReverificationService() checkpoint = VerificationCheckpoint.objects.create( course_id=unicode(self.course_id), checkpoint_location=self.final_checkpoint_location ) # Create credit course and set credit requirements. CreditCourse.objects.create(course_key=self.course_key, enabled=True) set_credit_requirements( self.course_key, [ { "namespace": "reverification", "name": checkpoint.checkpoint_location, "display_name": "Assessment 1", "criteria": {}, } ] ) reverification_service.skip_verification(self.user.id, unicode(self.course_id), self.final_checkpoint_location) requirement_status = get_credit_requirement_status( self.course_key, self.user.username, 'reverification', checkpoint.checkpoint_location ) self.assertEqual(SkippedReverification.objects.filter(user=self.user, course_id=self.course_id).count(), 1) self.assertEqual(len(requirement_status), 1) self.assertEqual(requirement_status[0].get('name'), checkpoint.checkpoint_location) self.assertEqual(requirement_status[0].get('status'), 'declined')
def test_skip_verification(self): """ Test adding skip attempt of a user for a reverification checkpoint. """ reverification_service = ReverificationService() VerificationCheckpoint.objects.create( course_id=unicode(self.course_id), checkpoint_location=self.final_checkpoint_location) reverification_service.skip_verification( self.user.id, unicode(self.course_id), self.final_checkpoint_location) self.assertEqual( SkippedReverification.objects.filter( user=self.user, course_id=self.course_id).count(), 1) # now test that a user can have only one entry for a skipped # reverification for a course reverification_service.skip_verification( self.user.id, unicode(self.course_id), self.final_checkpoint_location) self.assertEqual( SkippedReverification.objects.filter( user=self.user, course_id=self.course_id).count(), 1) # testing service for skipped attempt. self.assertEqual( reverification_service.get_status(self.user.id, unicode(self.course_id), self.final_checkpoint_location), 'skipped')