def test_removes_pii_from_api_search_dataset_without_fields_and_does_not_add_fields( self): res = remove_pii_from_api_search_dataset( sample_api_search_dataset_without_fields) json_res = json.loads(res)['results'][0] assert not any(elem in PII_LIST for elem in json_res) assert not any(elem in ['data_dict', 'validated_data_dict', 'extras'] for elem in json_res.keys())
def test_removes_pii_from_api_search_dataset(self): res = remove_pii_from_api_search_dataset(sample_api_search_dataset) json_res = json.loads(res)['results'][0] assert not any(elem in PII_LIST for elem in json_res) json_data_dict = json.loads(json_res['data_dict']) assert not any(elem in PII_LIST for elem in json_data_dict) json_validated_data_dict = json.loads(json_res['validated_data_dict']) assert not any(elem in PII_LIST for elem in json_validated_data_dict)
def test_does_not_error_with_strings_in_response(self): remove_pii_from_api_search_dataset(sample_api_search_dataset_strings)
def api_search_dataset(self, ver=1, register='dataset'): data = super(DGUApiController, self).search(ver, register) return remove_pii_from_api_search_dataset(data)