Exemplo n.º 1
0
 def test_applicant_list_after_invitation(self):
     self.application.is_submitted = True
     db.session.commit()
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     self.assertTrue(self.application.is_accepted)
     self.assertTrue(self.application.is_concluded)
     invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
     applicant_list = get_applicant_list(current_user=self.recruiter)[
         'info']
     self.assertEqual(len(applicant_list), 0)
     applicant_list = get_applicant_list(current_user=self.senior_recruiter)['info']
     self.assertEqual(len(applicant_list), 0)
Exemplo n.º 2
0
 def test_invited_history(self):
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
     result = application_history(self.applicant.id,
                                  current_user=self.admin)
     self.assertIsInstance(result, dict)
     self.assertIn('info', result)
     self.assertIsInstance(result['info'], dict)
     self.assertEqual(len(result['info']), 1)
     the_key = list(result['info'].keys())[0]
     app_data = result['info'][the_key]
     self.assertEqual(app_data['recruiter_id'], self.recruiter.id)
     self.assertEqual(app_data['recruiter_name'], self.recruiter.name)
     self.assertEqual(app_data['status'], 'invited')
     self.assertEqual(len(app_data['notes']), 2)
Exemplo n.º 3
0
 def test_invited_is_recently_invited(self):
     response = get_recently_invited_applicants(current_user=self.admin)
     self.assertEqual(len(response['info']), 0)
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     response = get_recently_invited_applicants(current_user=self.admin)
     self.assertEqual(len(response['info']), 0)
     invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
     response = get_recently_invited_applicants(current_user=self.admin)
     self.assertEqual(len(response['info']), 1)
     self.assertEqual(response['info'][0]['user_id'], self.applicant.id)
     self.assertEqual(response['info'][0]['user_name'], self.applicant.name)
     self.assertEqual(response['info'][0]['recruiter_id'], self.recruiter.id)
     self.assertEqual(response['info'][0]['recruiter_name'], self.recruiter.name)
     self.assertIsInstance(response['info'][0]['last_note_time'], str)
Exemplo n.º 4
0
def api_invite_applicant(applicant_id):
    """
    Marks an accepted applicant as "invited".

    Args:
        applicant_id (int): User key of applicant

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

    Error codes:
        Forbidden (403): If logged in user is not a senior recruiter
        Bad request (400): If the given user is not an applicant with "accepted" status
    """
    return jsonify(invite_applicant(applicant_id, current_user=current_user))
Exemplo n.º 5
0
 def test_invite_non_applicant(self):
     with self.assertRaises(BadRequestException):
         invite_applicant(self.not_applicant.id, current_user=self.senior_recruiter)
Exemplo n.º 6
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)
Exemplo n.º 7
0
 def test_invite_accepted_applicant(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
     self.assertTrue(self.application.is_accepted)
     self.assertTrue(self.application.is_invited)
Exemplo n.º 8
0
 def test_sr_reject_invited_applicant_forbidden(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
     with self.assertRaises(ForbiddenException):
         reject_applicant(self.applicant.id, current_user=self.senior_recruiter)