def _test_csv_mappings(self, sortinghat): """Test whether the mappings in the CSV are successfully met""" result = {} if not sortinghat: return result csv_mapping = load_mapping(self.enrich_index, self.connector) client = Elasticsearch(self.es_con, timeout=30) mapping_json = client.indices.get_mapping(index=self.enrich_index) es_mapping = ESMapping.from_json(index_name=self.enrich_index, mapping_json=mapping_json) result = csv_mapping.compare_properties(es_mapping) self.assertEqual(result['msg'], "")
def load_mapping(enrich_index, csv_name): cvs_path = os.path.join(SCHEMA_DIR, csv_name + '.csv') cvs_mapping = ESMapping.from_csv(enrich_index, cvs_path) return cvs_mapping