def test_no_applicants_listed_with_no_submitted_apps(self): self.application.is_submitted = False db.session.commit() 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)
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)
def test_no_applicants_listed_with_invited_app(self): self.application.is_submitted = True self.application.is_accepted = True self.application.is_concluded = True self.application.is_invited = True db.session.commit() 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)
def test_applicant_listed_after_submission(self): self.application.is_submitted = True self.application.recruiter_id = None db.session.commit() applicant_list = get_applicant_list(current_user=self.recruiter)['info'] self.assertEqual(len(applicant_list), 1) self.assertIn(self.application.user_id, applicant_list) self.assertEqual(applicant_list[self.application.user_id]['status'], 'new') applicant_list = get_applicant_list(current_user=self.senior_recruiter)['info'] self.assertEqual(len(applicant_list), 1) self.assertIn(self.application.user_id, applicant_list) self.assertEqual(applicant_list[self.application.user_id]['status'], 'new')
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)
def test_applicant_list_after_acceptance(self): self.application.is_submitted = True db.session.commit() accept_applicant(self.applicant.id, current_user=self.recruiter) applicant_list = get_applicant_list(current_user=self.recruiter)[ 'info'] self.assertEqual(len(applicant_list), 1) self.assertIn(self.application.user_id, applicant_list) self.assertEqual(applicant_list[self.application.user_id]['status'], 'accepted') applicant_list = get_applicant_list(current_user=self.senior_recruiter)['info'] self.assertEqual(len(applicant_list), 1) self.assertIn(self.application.user_id, applicant_list) self.assertEqual(applicant_list[self.application.user_id]['status'], 'accepted')
def api_get_applicant_list(): """ Gets the list of current applicants, including applications being processed, and accepted (but not invited) applicants. Returns: response (dict) Example: response = { 'info': { '1937622137': { 'user_id': 1937622137, # int character ID of user's main 'name': Twine Endashi, # string character name of user's main 'recruiter_id': 201837771, # int character ID of recruiter's main 'recruiter_name': 'Recruiter Ralph', # string name of recruiter 'status': 'claimed' | 'new' | 'accepted', }, '876876876': { [...] } ] } Error codes: Forbidden (403): If logged in user is not a recruiter or senior recruiter """ return jsonify(get_applicant_list(current_user=current_user))
def test_get_applicant_list_as_applicant(self): with self.assertRaises(ForbiddenException): get_applicant_list(current_user=self.applicant)
def test_get_applicant_list_as_snr_recruiter(self): response = get_applicant_list(current_user=self.admin) self.applicant_list_helper(response)