Example #1
0
 def test_release_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 = release_applicant(self.applicant.id, current_user=self.recruiter)
     self.assertDictEqual(response, {'status': 'ok'})
     self.assertEqual(len(self.application.notes), 2)
Example #2
0
def api_release_applicant(applicant_id):
    """
    Releases the claimed applicant from being claimed by a given recruiter.

    Args:
        applicant_id (int): User key of applicant claimed by recruiter

    Returns:
        {'status': 'ok'} if applicant is successfully released

    Error codes:
        Forbidden (403): If recruiter_id is not a recruiter, or logged in user
            is not an admin, senior recruiter, or this particular recruiter
        Bad Request (400): If applicant_id
            is not an applicant claimed by the recruiter
    """
    return jsonify(release_applicant(applicant_id, current_user=current_user))
Example #3
0
 def test_invite_unclaimed_applicant(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     release_applicant(self.applicant.id, current_user=self.recruiter)
     with self.assertRaises(BadRequestException):
         invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
Example #4
0
 def test_release_applicant_as_admin(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     with self.assertRaises(ForbiddenException):
         release_applicant(self.applicant.id, current_user=self.admin)
Example #5
0
 def test_release_applicant_as_senior_recruiter(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     response = release_applicant(self.applicant.id, current_user=self.senior_recruiter)
     self.assertDictEqual(response, {'status': 'ok'})
Example #6
0
 def test_release_not_applicant(self):
     with self.assertRaises(BadRequestException):
         release_applicant(self.not_applicant.id, current_user=self.recruiter)