Exemplo n.º 1
0
 def test_applicant_list_after_rejection(self):
     self.application.is_submitted = True
     db.session.commit()
     reject_applicant(self.applicant.id, current_user=self.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_two_applications(self):
     reject_applicant(self.applicant.id, current_user=self.recruiter)
     start_application(self.applicant)
     submit_application(self.applicant)
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     accept_applicant(self.applicant.id, current_user=self.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']), 2)
Exemplo n.º 3
0
 def test_rejected_history(self):
     reject_applicant(self.applicant.id, current_user=self.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'], 'rejected')
     self.assertEqual(len(app_data['notes']), 1)
Exemplo n.º 4
0
 def test_sr_reject_accepted_applicant(self):
     self.assertEqual(len(self.application.notes), 0)
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     self.assertEqual(len(self.application.notes), 1)
     accept_applicant(self.applicant.id, current_user=self.recruiter)
     self.assertEqual(len(self.application.notes), 2)
     response = reject_applicant(self.applicant.id, current_user=self.senior_recruiter)
     self.assertEqual(len(self.application.notes), 3)
     self.assertDictEqual(response, {'status': 'ok'})
     self.assertFalse(self.application.is_accepted)
     self.assertTrue(self.application.is_concluded)
     self.assertFalse(self.application.is_invited)
Exemplo n.º 5
0
def api_reject_applicant(applicant_id):
    """
    Sets an applicant's status to "rejected".

    Args:
        applicant_id (int): User key of applicant

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

    Error codes:
        Forbidden (403): If logged in user is not a senior recruiter or a
            recruiter who has claimed this applicant (including if they are
            not an applicant).
    """
    return jsonify(reject_applicant(applicant_id, current_user=current_user))
Exemplo n.º 6
0
 def test_start_new_application_after_rejection(self):
     reject_applicant(self.applicant.id, self.recruiter)
     start_application(self.applicant)
     application = Application.get_for_user(self.applicant.id)
     self.assertIsInstance(application, Application)
     self.assertEqual(application.user_id, self.applicant.id)
Exemplo n.º 7
0
 def test_invite_rejected_applicant(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     reject_applicant(self.applicant.id, current_user=self.recruiter)
     with self.assertRaises(BadRequestException):
         invite_applicant(self.applicant.id, current_user=self.senior_recruiter)
Exemplo n.º 8
0
 def test_reject_applicant_as_admin(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     with self.assertRaises(ForbiddenException):
         reject_applicant(self.applicant.id, current_user=self.admin)
Exemplo n.º 9
0
 def test_reject_applicant_as_senior_recruiter(self):
     claim_applicant(self.applicant.id, current_user=self.recruiter)
     response = reject_applicant(self.applicant.id, current_user=self.recruiter)
     self.assertDictEqual(response, {'status': 'ok'})
     self.assertFalse(self.application.is_accepted)
     self.assertTrue(self.application.is_concluded)
Exemplo n.º 10
0
 def test_reject_not_applicant(self):
     with self.assertRaises(ForbiddenException):
         reject_applicant(self.not_applicant.id, current_user=self.recruiter)
Exemplo n.º 11
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)