def test_unaccept_applicant(self): self.assertEqual(len(self.application.notes), 0) response = claim_applicant(self.applicant.id, current_user=self.recruiter) self.assertDictEqual(response, {'status': 'ok'}) self.assertEqual(len(self.application.notes), 1) response = accept_applicant(self.applicant.id, current_user=self.recruiter) self.assertTrue(self.application.is_accepted) response = unaccept_applicant(self.applicant.id, current_user=self.senior_recruiter) self.assertFalse(self.application.is_accepted) self.assertEqual(self.application.recruiter_id, self.recruiter.id) self.assertDictEqual(response, {'status': 'ok'}) self.assertEqual(len(self.application.notes), 3)
def api_unaccept_applicant(applicant_id): """ Returns an accepted applicant back to claimed status with the original recruiter. Args: applicant_id (int): User key of applicant claimed by recruiter Returns: {'status': 'ok'} if applicant is successfully unaccepted Error codes: Forbidden (403): the current user is not a senior recruiter, or the applicant has no open & accepted application. Bad Request (400): If the applicant is not in an open application. """ return jsonify(unaccept_applicant(applicant_id, current_user=current_user))
def test_reject_unaccept_applicant_as_not_applicant(self): claim_applicant(self.applicant.id, current_user=self.recruiter) accept_applicant(self.applicant.id, current_user=self.recruiter) with self.assertRaises(ForbiddenException): unaccept_applicant(self.applicant.id, current_user=self.not_applicant)
def test_unaccept_before_accept(self): claim_applicant(self.applicant.id, current_user=self.recruiter) with self.assertRaises(ForbiddenException): unaccept_applicant(self.applicant.id, current_user=self.senior_recruiter)
def test_release_not_applicant(self): with self.assertRaises(BadRequestException): unaccept_applicant(self.not_applicant.id, current_user=self.senior_recruiter)