def _add_reference_stmts(self, prop): """Add reference statements and its requisites.""" refprop, refclass = self._get_reference_prop(prop) top_class = get_top_class(prop) top_refclass = get_top_class(refprop) if top_class != top_refclass: top_refclass_name = get_qn(self.lang, top_refclass) self.ref_top_classes[top_refclass_name] = top_refclass self._add_mandatory_stmts(top_refclass) self._add_declaration_stmt(top_refclass) # addjust the key value in leafref path self._add_leafref_path_key_stmts(prop) self._add_list_stmts(refclass) self._add_prop_stmts(refprop) self._add_reference_stmt(prop, refprop)
def _print_test_case_crud_stmts(self, stmts, clazz, top_classes): for top_class in top_classes: self._print_crud_create_stmts(top_class) top_class = get_top_class(clazz) self._print_crud_create_stmts(top_class) self._print_crud_read_stmts(top_class)
def build_test_case(self, clazz): """Build a single test case.""" self.clazz = clazz self.test_name = clazz.qn().lower().replace('.', '_') top_class = get_top_class(clazz) self._add_declaration_stmt(top_class) self._add_requisite_stmts(clazz) self._add_mandatory_stmts(top_class) self._add_list_stmts(clazz) for prop in clazz.properties(): self._add_prop_stmts(prop)
def _print_crud_delete_stmts(self, clazz): top_class = get_top_class(clazz) top_obj_name = get_obj_name(top_class) fmt = self._get_crud_fmt('delete') self._print_logging('Deleting {}...'.format(top_obj_name)) self._write_end(fmt.format(top_obj_name))