Commit f07d8524 authored by David Mendez's avatar David Mendez

Implement parsing of a single property in source for mapping

parent d204bffe
......@@ -35,6 +35,39 @@ class TestMappingsHandling(unittest.TestCase):
self.assertEqual(mappings_to_apply_got, mappings_to_apply_must_be,
msg='The mappings were not produced correctly!')
def test_parses_mapping_from_es_for_a_multiple_properties(self):
"""
Tests that given a mapping from ES it produces a mapping to put to the subset index for multiple properties
"""
sample_mapping_path = 'app/es_subset_generator/test/data/sample_mapping_1.json'
with open(sample_mapping_path, 'rt') as sample_mapping_file:
mapping_from_base_index = json.load(sample_mapping_file)
source = [
'molecule_properties.hba',
'molecule_synonyms',
'molecule_properties.psa',
'_metadata.drug.drug_data.withdrawn_year',
'_metadata.drug.drug_data.prodrug',
'molecule_properties.molecular_species',
'helm_notation'
]
mappings_to_apply_got = mappings.parse_mapping_from_es_response(mapping_from_base_index, source)
print('mappings_to_apply_got:')
print(json.dumps(mappings_to_apply_got, indent=4))
mappings_to_apply_must_be = {
"properties": {
'pref_name': {
'type': 'keyword'
},
}
}
# self.assertEqual(mappings_to_apply_got, mappings_to_apply_must_be,
# msg='The mappings were not produced correctly!')
def test_locates_source_config_of_property(self):
"""
Test that it locates the config of a property
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment