def test_excel_typeDefs_entityTypes(): temp_filepath = "./temp_test_typeDefs_entityTYpes.xlsx" ec = ExcelConfiguration() reader = ExcelReader(ec) max_cols = len(ExcelReader.TEMPLATE_HEADERS["BulkEntities"]) # "Entity TypeName", "name", "description", # "isOptional", "isUnique", "defaultValue", # "typeName", "displayName", "valuesMinCount", # "valuesMaxCount", "cardinality", "includeInNotification", # "indexType", "isIndexable" json_rows = [ ["demoType", "attrib1", "Some desc", "True", "False", None, "string", None, None, None, None, None, None, None ] ] setup_workbook(temp_filepath, "EntityDefs", max_cols, json_rows) results = reader.parse_entity_defs(temp_filepath) assert("entityDefs" in results) assert(len(results["entityDefs"]) == 1) assert(results["entityDefs"][0]["attributeDefs"][0]["name"] == "attrib1") remove_workbook(temp_filepath)
def test_excel_typeDefs_entityTypes_superTypes(): temp_filepath = "./temp_test_typeDefs_entityTypesWithSuperTypes.xlsx" ec = ExcelConfiguration() reader = ExcelReader(ec) headers = ExcelReader.TEMPLATE_HEADERS["EntityDefs"] + ['Entity superTypes'] # "Entity TypeName", "name", "description", # "isOptional", "isUnique", "defaultValue", # "typeName", "displayName", "valuesMinCount", # "valuesMaxCount", "cardinality", "includeInNotification", # "indexType", "isIndexable" json_rows = [ ["demoType", "attrib1", "Some desc", "True", "False", None, "string", None, None, None, None, None, None, None, "DataSet;Blah" ], ["demoType", "attrib2", "Some desc", "True", "False", None, "string", None, None, None, None, None, None, None, "Asset" ], ["demoType", "attrib3", "Some desc", "True", "False", None, "string", None, None, None, None, None, None, None, None ] ] setup_workbook_custom_sheet( temp_filepath, "EntityDefs", headers, json_rows) results = reader.parse_entity_defs(temp_filepath) assert("entityDefs" in results) assert(len(results["entityDefs"]) == 1) superTypes = results["entityDefs"][0]["superTypes"] assert( len(superTypes) == 3 ) assert( set(superTypes) == set(["DataSet", "Blah", "Asset"]) ) remove_workbook(temp_filepath)