def test_delete_address_of_a_diff_candidate(self, access_token_first, talent_pool): """ Test: Attempt to delete the address of a different Candidate Expect: 403 """ data_1 = generate_single_candidate_data([talent_pool.id]) data_2 = generate_single_candidate_data([talent_pool.id]) # Create candidate_1 and candidate_2 create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data_1) candidate_1_id = create_resp.json()['candidates'][0]['id'] create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data_2) candidate_2_id = create_resp.json()['candidates'][0]['id'] # Retrieve candidate_2's addresses get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_2_id, access_token_first) can_2_addresses = get_resp.json()['candidate']['addresses'] # Delete candidate_2's id using candidate_1_id url = CandidateApiUrl.ADDRESS % (candidate_1_id, can_2_addresses[0]['id']) updated_resp = send_request('delete', url, access_token_first) print response_info(updated_resp) assert updated_resp.status_code == 403 assert updated_resp.json( )['error']['code'] == custom_error.ADDRESS_FORBIDDEN
def test_delete_can_custom_field(self, access_token_first, talent_pool, domain_custom_fields): """ Test: Remove Candidate's custom field from db Expect: 204, Candidate's custom fields must be less 1 AND no CustomField should be deleted """ # Create Candidate data = generate_single_candidate_data( [talent_pool.id], custom_fields=domain_custom_fields) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate custom fields candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_custom_fields = get_resp.json()['candidate']['custom_fields'] db.session.commit() custom_field_id_1 = CandidateCustomField.get_by_id( can_custom_fields[0]['id']).custom_field_id custom_field_id_2 = CandidateCustomField.get_by_id( can_custom_fields[1]['id']).custom_field_id # Remove one of Candidate's custom field url = CandidateApiUrl.CUSTOM_FIELD % (candidate_id, can_custom_fields[0]['id']) updated_resp = send_request('delete', url, access_token_first) print response_info(updated_resp) assert updated_resp.status_code == 204 assert CustomField.query.get( custom_field_id_1) # CustomField should still be in db assert CustomField.query.get( custom_field_id_2) # CustomField should still be in db
def test_update_last_name(self, access_token_first, talent_pool): """ Test: Update candidate's last name Expect: 200, candidate's full name should also be updated """ # Create candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', self.URL, access_token_first, data) candidate_id = create_resp.json()['candidates'][0]['id'] # Retrieve candidate get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_full_name = get_resp.json()['candidate']['full_name'] # Update candidate's last name data = {'candidates': [{'last_name': fake.first_name()}]} update_resp = send_request('patch', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first, data) print response_info(update_resp) # Retrieve candidate get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) updated_full_name = get_resp.json()['candidate']['full_name'] assert updated_full_name != candidate_full_name assert updated_full_name.endswith(data['candidates'][0]['last_name'])
def test_delete_all_of_candidates_addresses(self, access_token_first, talent_pool): """ Test: Remove all of candidate's addresses from db Expect: 204, Candidate should not have any addresses left """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Remove all of Candidate's addresses candidate_id = create_resp.json()['candidates'][0]['id'] updated_resp = send_request('delete', CandidateApiUrl.ADDRESSES % candidate_id, access_token_first, data) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_dict_after_update = get_resp.json()['candidate'] assert updated_resp.status_code == 204 assert len(can_dict_after_update['addresses']) == 0
def test_multiple_is_current_experiences(self, access_token_first, talent_pool): """ Test: Add more than one CandidateExperience with is_current set to True Expect: 200, but only one CandidateExperience must have is_current True, the rest must be False """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Add a new work experience to the existing Candidate with is_current set to True candidate_id = create_resp.json()['candidates'][0]['id'] send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) updated_candidate_dict = get_resp.json()['candidate'] updated_can_experiences = updated_candidate_dict['work_experiences'] # Only one of the experiences must be current! assert sum([ 1 for experience in updated_can_experiences if experience['is_current'] ]) == 1
def test_delete_can_address(self, access_token_first, talent_pool): """ Test: Remove Candidate's address from db Expect: 204, Candidate's addresses must be less 1 """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(create_resp) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_addresses = get_resp.json()['candidate']['addresses'] # Number of Candidate's addresses can_addresses_count = len(can_addresses) # Remove one of Candidate's addresses url = CandidateApiUrl.ADDRESS % (candidate_id, can_addresses[0]['id']) updated_resp = send_request('delete', url, access_token_first) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_dict_after_update = get_resp.json()['candidate'] assert updated_resp.status_code == 204 assert len( can_dict_after_update['addresses']) == can_addresses_count - 1
def test_check_for_id(access_token_first, talent_pool): """ Test: Send candidate-dicts to check_for_id to ensure the function is behaving as expected Expect: False if candidate-dict has missing id-key(s) """ # Create candidate data = generate_single_candidate_data([talent_pool.id]) resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(resp) candidate_id = resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_dict = get_resp.json()['candidate'] r = check_for_id(_dict=candidate_dict) assert r is None # Send candidate-dict with an empty dict, e.g. work_preference = {} _dict = candidate_dict.copy() _dict['work_preference'] = {} r = check_for_id(_dict=_dict) assert r is None # Remove top-level id-key _dict = candidate_dict.copy() del _dict['id'] r = check_for_id(_dict=_dict) assert r is False # Remove id-key of the first address-dict in addresses _dict = candidate_dict.copy() del _dict['addresses'][0]['id'] r = check_for_id(_dict=_dict) assert r is False # Remove id-key from first education-dict in educations _dict = candidate_dict.copy() del _dict['educations'][0]['id'] r = check_for_id(_dict=_dict) assert r is False # Remove id-key from first degree-dict in educations _dict = candidate_dict.copy() del _dict['educations'][0]['degrees'][0]['id'] r = check_for_id(_dict=_dict) assert r is False # Remove id-key from first degree_bullet-dict in degrees _dict = candidate_dict.copy() del _dict['educations'][0]['degrees'][0]['bullets'][0]['id'] r = check_for_id(_dict=_dict) assert r is False # Remove id-key from work_preference _dict = candidate_dict.copy() del _dict['work_preference']['id'] r = check_for_id(_dict=_dict) assert r is False
def test_bulk_delete_using_ids(self, user_first, access_token_first, talent_pool): """ Test: Delete candidates in bulk """ user_first.role_id = Role.get_by_name('DOMAIN_ADMIN').id db.session.commit() # Create 50 candidates number_of_candidates = 5 candidates_data = generate_single_candidate_data( talent_pool_ids=[talent_pool.id], number_of_candidates=number_of_candidates) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, candidates_data) assert create_resp.status_code == requests.codes.CREATED print response_info(create_resp) created_candidates = create_resp.json()['candidates'] assert len(created_candidates) == number_of_candidates # Delete all 50 candidates candidates_for_delete = dict(_candidate_ids=[ candidate['id'] for candidate in created_candidates ]) bulk_del_resp = send_request('delete', CandidateApiUrl.CANDIDATES, access_token_first, candidates_for_delete) print response_info(bulk_del_resp) assert bulk_del_resp.status_code == requests.codes.NO_CONTENT
def test_archive_candidate_and_retrieve_it(self, access_token_first, talent_pool): """ Test: Archive a Candidate and then retrieve it Expect: 404, Not Found error """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Archive Candidate candidate_id = create_resp.json()['candidates'][0]['id'] archive_data = {'candidates': [{'id': candidate_id, 'archive': True}]} resp = send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, archive_data) print response_info(resp) # Retrieve Candidate get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) print response_info(get_resp) assert get_resp.status_code == requests.codes.NOT_FOUND assert get_resp.json( )['error']['code'] == custom_error.CANDIDATE_IS_ARCHIVED
def test_update_experience_bullet(self, access_token_first, talent_pool): """ Test: Update an existing CandidateExperienceBullet Since this is an update only, the number of candidate's experience_bullets must remain unchanged. Expect: 200 """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_dict = get_resp.json()['candidate'] experience_dict = candidate_dict['work_experiences'][0] candidate_experience_bullet_count = len(experience_dict['bullets']) # Update CandidateExperienceBullet data = GenerateCandidateData.work_experiences( candidate_id=candidate_id, experience_id=experience_dict['id'], bullet_id=experience_dict['bullets'][0]['id']) updated_resp = send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) updated_can_dict = get_resp.json()['candidate'] updated_exp_bullet_dict = updated_can_dict['work_experiences'][0][ 'bullets'] exp_bullet_dict_from_data = data['candidates'][0]['work_experiences'][ 0]['bullets'][0] assert candidate_experience_bullet_count == len( updated_exp_bullet_dict) assert updated_exp_bullet_dict[0][ 'description'] == exp_bullet_dict_from_data['description']
def test_add_experience_bullet(self, access_token_first, talent_pool): """ Test: Adds a CandidateExperienceBullet to an existing CandidateExperience Total number of candidate's experience_bullet must increase by 1, and number of candidate's CandidateExperience must remain unchanged. Expect: 200 """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_dict = get_resp.json()['candidate'] bullet_count = len(candidate_dict['work_experiences'][0]['bullets']) # Add CandidateExperienceBullet to existing CandidateExperience data = GenerateCandidateData.work_experiences( candidate_id=candidate_id, experience_id=candidate_dict['work_experiences'][0]['id']) updated_resp = send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) updated_can_dict = get_resp.json()['candidate'] updated_experiences = updated_can_dict['work_experiences'] bullets_from_data = data['candidates'][0]['work_experiences'][0][ 'bullets'][0] assert isinstance(updated_experiences, list) assert candidate_id == updated_can_dict['id'] assert updated_experiences[0]['bullets'][-1][ 'description'] == bullets_from_data['description'] assert len(updated_experiences[0]['bullets']) == bullet_count + 1 assert len(updated_experiences) == len( updated_can_dict['work_experiences'])
def test_add_candidate_experience(self, access_token_first, talent_pool): """ Test: Add a CandidateExperience to an existing Candidate. Number of Candidate's CandidateExperience must increase by 1. Expect: 200 """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(create_resp) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_dict = get_resp.json()['candidate'] candidate_experience_count = len(candidate_dict['work_experiences']) # Add CandidateExperience data = GenerateCandidateData.work_experiences( candidate_id=candidate_id) updated_resp = send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) updated_can_dict = get_resp.json()['candidate'] can_experiences = updated_can_dict['work_experiences'] can_experiences_from_data = data['candidates'][0]['work_experiences'] assert candidate_id == updated_can_dict['id'] assert isinstance(can_experiences, list) assert can_experiences[0]['organization'] == can_experiences_from_data[ 0]['organization'] assert can_experiences[0]['position'] == can_experiences_from_data[0][ 'position'] assert can_experiences[0]['city'] == can_experiences_from_data[0][ 'city'] assert can_experiences[0]['subdivision'] == pycountry.subdivisions.get( code=can_experiences_from_data[0]['subdivision_code']).name assert len(can_experiences) == candidate_experience_count + 1
def test_delete_candidates_custom_fields(self, access_token_first, talent_pool, domain_custom_fields): """ Test: Remove all of candidate's custom fields from db Expect: 204, Candidate should not have any custom fields left AND no CustomField should be deleted """ # Create Candidate data = generate_single_candidate_data( [talent_pool.id], custom_fields=domain_custom_fields) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate's custom fields candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_custom_fields = get_resp.json()['candidate']['custom_fields'] db.session.commit() custom_field_id_1 = CandidateCustomField.query.get( can_custom_fields[0]['id']).custom_field_id custom_field_id_2 = CandidateCustomField.query.get( can_custom_fields[1]['id']).custom_field_id # Remove all of Candidate's custom fields updated_resp = send_request( 'delete', CandidateApiUrl.CUSTOM_FIELDS % candidate_id, access_token_first) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_dict_after_update = get_resp.json()['candidate'] assert updated_resp.status_code == 204 assert len(can_dict_after_update['custom_fields']) == 0 assert CustomField.query.get( custom_field_id_1) # CustomField should still be in db assert CustomField.query.get( custom_field_id_2) # CustomField should still be in db
def test_delete_address_of_a_candidate_belonging_to_a_diff_user( self, access_token_first, talent_pool, access_token_same): """ Test: Delete the address of a Candidate that belongs to a different user in the same domain Expect: 204 """ # Create candidate_1 & candidate_2 with user_first & user_first_2 data = generate_single_candidate_data([talent_pool.id]) create_resp_1 = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve candidate_1 candidate_1_id = create_resp_1.json()['candidates'][0]['id'] # Delete candidate_1's address with user_first_2 logged in updated_resp = send_request('delete', CandidateApiUrl.ADDRESSES % candidate_1_id, access_token_same) print response_info(updated_resp) assert updated_resp.status_code == 204
def test_delete_can_aoi_of_a_candidate_belonging_to_a_diff_user( self, access_token_first, talent_pool, access_token_second): """ Test: Attempt to delete the aois of a Candidate that belongs to a user in a diff domain Expect: 204 """ # Create candidate_1 & candidate_2 with user_first & user_first_2 data = generate_single_candidate_data([talent_pool.id]) create_resp_1 = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) candidate_1_id = create_resp_1.json()['candidates'][0]['id'] # Delete candidate_1's areas of interest with user_first_2 logged in updated_resp = send_request('delete', CandidateApiUrl.AOIS % candidate_1_id, access_token_second) print response_info(updated_resp) assert updated_resp.status_code == 403 assert updated_resp.json( )['error']['code'] == custom_error.CANDIDATE_FORBIDDEN
def test_archive_candidate_via_email(self, access_token_first, talent_pool): """ Test: Archive a Candidate via candidate's email Expect: 200 """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] # Archive Candidate archive_data = {'candidates': [{'id': candidate_id, 'archive': True}]} resp = send_request('patch', CandidateApiUrl.CANDIDATES, access_token_first, archive_data) print response_info(resp) assert resp.status_code == requests.codes.OK assert resp.json()['archived_candidates'][0] == candidate_id
def test_remove_id_key(access_token_first, talent_pool): """ Test: Send candidate-dict with IDs to remove_id_key() to help remove all the id-keys from candidate-dict Expect: Candidate dict with no id-key """ # Create Candidate data = generate_single_candidate_data([talent_pool.id]) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) candidate_dict_with_ids = get_resp.json()['candidate'] print response_info(get_resp) # Send Candidate dict with IDs to remove_id_keys candidate_dict_without_ids = remove_id_key( _dict=candidate_dict_with_ids.copy()) print "candidate_dict_without_ids = %s" % candidate_dict_without_ids
def test_delete_can_area_of_interest(self, access_token_first, talent_pool, domain_aois): """ Test: Remove Candidate's area of interest from db Expect: 204, Candidate's aois must be less 1 AND no AreaOfInterest should be deleted """ # Create Candidate data = generate_single_candidate_data([talent_pool.id], domain_aois) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate areas of interest candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_aois = get_resp.json()['candidate']['areas_of_interest'] # Current number of Candidate's areas of interest candidate_aois_count = len(can_aois) # Remove one of Candidate's area of interest url = CandidateApiUrl.AOI % (candidate_id, can_aois[0]['id']) updated_resp = send_request('delete', url, access_token_first) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_dict_after_update = get_resp.json()['candidate'] assert updated_resp.status_code == 204 assert len(can_dict_after_update['areas_of_interest'] ) == candidate_aois_count - 1 assert AreaOfInterest.query.get( can_aois[0]['id']) # AreaOfInterest should still be in db assert AreaOfInterest.query.get( can_aois[1]['id']) # AreaOfInterest should still be in db
def test_delete_all_of_candidates_areas_of_interest( self, access_token_first, talent_pool, domain_aois): """ Test: Remove all of candidate's aois from db Expect: 204, Candidate should not have any aois left """ # Create Candidate data = generate_single_candidate_data([talent_pool.id], domain_aois) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve Candidate's aois candidate_id = create_resp.json()['candidates'][0]['id'] get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_aois = get_resp.json()['candidate']['areas_of_interest'] # Remove all of Candidate's areas of interest updated_resp = send_request('delete', CandidateApiUrl.AOIS % candidate_id, access_token_first) print response_info(updated_resp) # Retrieve Candidate after update get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) can_dict_after_update = get_resp.json()['candidate'] assert updated_resp.status_code == 204 assert len(can_dict_after_update['areas_of_interest']) == 0 assert AreaOfInterest.query.get( can_aois[0]['id']) # AreaOfInterest should still be in db assert AreaOfInterest.query.get( can_aois[1]['id']) # AreaOfInterest should still be in db
def test_delete_custom_fields_of_a_candidate_belonging_to_a_diff_user( self, access_token_first, talent_pool, access_token_second, domain_custom_fields): """ Test: Delete custom fields of a Candidate that belongs to a user in a different domain Expect: 204 """ # Create candidate_1 & candidate_2 with user_first & user_first_2 data = generate_single_candidate_data( [talent_pool.id], custom_fields=domain_custom_fields) create_resp_1 = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) # Retrieve candidate_1 candidate_1_id = create_resp_1.json()['candidates'][0]['id'] # Delete candidate_1's custom fields with user_first_2 logged in url = CandidateApiUrl.CUSTOM_FIELDS % candidate_1_id updated_resp = send_request('delete', url, access_token_second) print response_info(updated_resp) assert updated_resp.status_code == 403 assert updated_resp.json( )['error']['code'] == custom_error.CANDIDATE_FORBIDDEN
def test_delete_candidate_with_full_profile(self, access_token_first, user_first, talent_pool, domain_aois, domain_custom_fields): """ Test: Create a candidate with all fields and delete it """ user_first.role_id = Role.get_by_name('DOMAIN_ADMIN').id db.session.commit() # Create candidate with full profile data = generate_single_candidate_data( talent_pool_ids=[talent_pool.id], areas_of_interest=domain_aois, custom_fields=domain_custom_fields) create_resp = send_request('post', CandidateApiUrl.CANDIDATES, access_token_first, data) print response_info(create_resp) candidate_id = create_resp.json()['candidates'][0]['id'] # Notes data = {'notes': [{'title': fake.word(), 'comment': 'something nice'}]} create_resp = send_request('post', CandidateApiUrl.NOTES % candidate_id, access_token_first, data) print response_info(create_resp) # Tags data = {'tags': [{'name': 'software-stuff'}]} create_resp = send_request('post', CandidateApiUrl.TAGS % candidate_id, access_token_first, data) print response_info(create_resp) # References data = { 'candidate_references': [{ 'name': fake.name(), 'position_title': fake.job(), 'comments': 'Do not hire this guy!', 'reference_email': { 'is_default': None, 'address': fake.safe_email(), 'label': None }, 'reference_phone': { 'is_default': True, 'value': '14055689944' }, 'reference_web_address': { 'url': fake.url(), 'description': fake.bs() } }] } create_resp = send_request('post', CandidateApiUrl.REFERENCES % candidate_id, access_token_first, data) print response_info(create_resp) # Delete candidate del_resp = send_request('delete', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) print response_info(del_resp) assert del_resp.status_code == requests.codes.NO_CONTENT # Retrieve candidate. Expect NOT FOUND error get_resp = send_request('get', CandidateApiUrl.CANDIDATE % candidate_id, access_token_first) print response_info(get_resp) assert get_resp.status_code == requests.codes.NOT_FOUND # Candidate should no longer have any notes in db candidate_notes = CandidateTextComment.get_by_candidate_id( candidate_id) assert candidate_notes == [] # Candidate should no longer have any tags in db candidate_tags = CandidateTag.get_all(candidate_id) assert candidate_tags == [] # Candidate should no longer have any references in db candidate_references = CandidateReference.get_all(candidate_id) assert candidate_references == []