def get_list_objs_from_csv(self, path_to_exported_file): """Get and return list of objects from CSV file of exported objects in test's temporary directory 'path_to_export_dir'. """ # pylint: disable=invalid-name dict_list_objs_scopes = file_utils.get_list_objs_scopes_from_csv( path_to_csv=path_to_exported_file) dict_key = dict_list_objs_scopes.iterkeys().next() # 'Control' to 'controls', 'Control Snapshot' to 'controls' obj_name_from_dict = objects.get_plural( StringMethods.get_first_word_from_str(dict_key)) if self.obj_name == obj_name_from_dict: return self._create_list_objs( entity_factory=self.entities_factory_cls, list_scopes=dict_list_objs_scopes[dict_key]) else: raise ValueError(messages.ExceptionsMessages.err_csv_format. format(dict_list_objs_scopes))
def get_list_objs_from_csv(self, path_to_exported_file): """Get and return list of objects from CSV file of exported objects in test's temporary directory 'path_to_export_dir'. """ # pylint: disable=invalid-name dict_list_objs_scopes = file_utils.get_list_objs_scopes_from_csv( path_to_csv=path_to_exported_file) dict_key = dict_list_objs_scopes.iterkeys().next() # 'Control' to 'controls', 'Control Snapshot' to 'controls' obj_name_from_dict = objects.get_plural( StringMethods.get_first_word_from_str(dict_key)) if self.obj_name == obj_name_from_dict: return self._create_list_objs( entity_factory=self.entities_factory_cls, list_scopes=dict_list_objs_scopes[dict_key]) else: raise ValueError(messages.ExceptionsMessages.err_csv_format. format(dict_list_objs_scopes))
def get_list_objs_from_csv(self, path_to_export_dir): """Get and return list of objects from CSV file of exported objects in test's temporary directory 'path_to_export_dir'. """ # pylint: disable=invalid-name path_to_exported_file = os.path.join( path_to_export_dir, path.EXPORTED_FILE_NAME) dict_list_objs_scopes = file_utils.get_list_objs_scopes_from_csv( path_to_csv=path_to_exported_file) dict_key = dict_list_objs_scopes.iterkeys().next() # 'Control' to 'controls', 'Control Snapshot' to 'controls' obj_name_from_dict = objects.get_plural( string_utils.get_first_word_from_str(dict_key)) if self.obj_name == obj_name_from_dict: return self.create_list_objs(entity_factory=self.entities_factory_cls, list_scopes=dict_list_objs_scopes[dict_key]) else: raise ValueError(messages.ERR_CSV_FORMAT.format(dict_list_objs_scopes))
def get_list_objs_from_csv(self, path_to_export_dir): """Get and return list of objects from CSV file of exported objects in test's temporary directory 'path_to_export_dir'. """ # pylint: disable=invalid-name path_to_exported_file = os.path.join(path_to_export_dir, path.EXPORTED_FILE_NAME) dict_list_objs_scopes = file_utils.get_list_objs_scopes_from_csv( path_to_csv=path_to_exported_file) dict_key = dict_list_objs_scopes.iterkeys().next() # 'Control' to 'controls', 'Control Snapshot' to 'controls' obj_name_from_dict = objects.get_plural( string_utils.get_first_word_from_str(dict_key)) if self.obj_name == obj_name_from_dict: return self.create_list_objs( entity_factory=self.entities_factory_cls, list_scopes=dict_list_objs_scopes[dict_key]) else: raise ValueError( messages.ERR_CSV_FORMAT.format(dict_list_objs_scopes))