def api_character_mail(character_id): """ Get mail headers for a given character. Returned dictionary is of the form {'info': [mail_1, mail_2, ...]}. Each mail is as returned by ESI, with the additional key `from_name`, and if redlisted then `redlisted` whose value is True. Recipients have the additional key `recipient_name`. A mail is redlisted if any of the participants in the mail are redlisted. Args: character_id (int) last_mail_id (int, optional): Return only mails with ID lower than this Returns: response (dict) Error codes: Forbidden (403): If logged in user is not a senior recruiter or a recruiter who has claimed the given user """ return jsonify( get_character_mail(character_id, last_mail_id=request.args.get('last_mail_id', None), current_user=current_user))
def test_get_admin_mail(self): with self.assertRaises(ForbiddenException): get_character_mail(self.admin.id, current_user=self.recruiter) with self.assertRaises(ForbiddenException): get_character_mail(self.admin.id, current_user=self.other_recruiter) with self.assertRaises(ForbiddenException): get_character_mail(self.admin.id, current_user=self.senior_recruiter) with self.assertRaises(ForbiddenException): get_character_mail(self.admin.id, current_user=self.admin)
def test_get_applicant_mail_as_admin(self): with self.assertRaises(ForbiddenException): get_character_mail(self.applicant.id, current_user=self.admin)
def test_get_applicant_mail_as_other_recruiter(self): result = get_character_mail(self.applicant.id, current_user=self.other_recruiter) self.helper_test_mail_success(result)
def mail_body_test_as_admin(self): mail_id = get_character_mail( self.applicant.id, current_user=self.recruiter)['info'][0]['mail_id'] with self.assertRaises(ForbiddenException): get_mail_body(mail_id, current_user=self.admin)
def mail_body_test_as_other_recruiter(self): mail_id = get_character_mail( self.applicant.id, current_user=self.recruiter)['info'][0]['mail_id'] result = get_mail_body(mail_id, current_user=self.other_recruiter) self.helper_test_mail_body_success(result['info'])