diff --git a/packageship/packageship/application/apps/package/function/build_depend.py b/packageship/packageship/application/apps/package/function/build_depend.py index b65464b954fbf7c4a75f81cc199ea930e6115f2c..92351e782f729c4ce7c9de3b7d813f3b8f5a7dd4 100644 --- a/packageship/packageship/application/apps/package/function/build_depend.py +++ b/packageship/packageship/application/apps/package/function/build_depend.py @@ -19,6 +19,7 @@ class BuildDepend(): search_db:Query an instance of a database class result_dict:A dictionary to store the data that needs to be echoed source_dict:A dictionary to store the searched source code package name + not_found_components: Contain the package not found components """ def __init__(self, pkg_name_list, db_list, self_build=0, history_dict=None): @@ -35,6 +36,7 @@ class BuildDepend(): self.source_dict = dict() self.history_dicts = history_dict if history_dict else {} + self.not_found_components = set() def build_depend_main(self): """ @@ -44,16 +46,17 @@ class BuildDepend(): ResponseCode: response code result_dict: Dictionary of query results source_dict: Dictionary of source code package + not_found_components: Set of package not found components Raises: """ if not self.search_db.db_object_dict: - return ResponseCode.DIS_CONNECTION_DB, None, None + return ResponseCode.DIS_CONNECTION_DB, None, None, set() if self._self_build == 0: code = self.build_depend(self.pkg_name_list) if None in self.result_dict: del self.result_dict[None] - return code, self.result_dict, None + return code, self.result_dict, None, self.not_found_components if self._self_build == 1: self.self_build(self.pkg_name_list) @@ -64,9 +67,9 @@ class BuildDepend(): # Here, a place holder is needed to prevent unpacking errors during call # 2, This function is an auxiliary function of other modules. # The status code is not the final display status code - return ResponseCode.SUCCESS, self.result_dict, self.source_dict + return ResponseCode.SUCCESS, self.result_dict, self.source_dict, self.not_found_components - return ResponseCode.PARAM_ERROR, None, None + return ResponseCode.PARAM_ERROR, None, None, set() def build_depend(self, pkg_list): """ @@ -77,8 +80,8 @@ class BuildDepend(): ResponseCode: response code Raises: """ - res_status, build_list = self.search_db.get_build_depend(pkg_list) - + res_status, build_list, not_fd_com_build = self.search_db.get_build_depend(pkg_list) + self.not_found_components.update(not_fd_com_build) if not build_list: return res_status if res_status == ResponseCode.DIS_CONNECTION_DB else \ ResponseCode.PACK_NAME_NOT_FOUND @@ -86,9 +89,10 @@ class BuildDepend(): # create root node and get next search list search_list = self._create_node_and_get_search_list(build_list, pkg_list) - code, res_dict = \ + code, res_dict, not_fd_com_install = \ InstallDepend(self.db_list).query_install_depend(search_list, self.history_dicts) + self.not_found_components.update(not_fd_com_install) if not res_dict: return code @@ -185,8 +189,8 @@ class BuildDepend(): return next_src_set = set() - _, bin_info_lis = self.search_db.get_build_depend(pkg_name_li) - + _, bin_info_lis, not_fd_com = self.search_db.get_build_depend(pkg_name_li) + self.not_found_components.update(not_fd_com) if not bin_info_lis: return diff --git a/packageship/packageship/application/apps/package/function/install_depend.py b/packageship/packageship/application/apps/package/function/install_depend.py index 69ea9150d8258e096610fcabdd1d5b779e862b73..f3cf05e31141aeeb6b8e8475e6ebf647bce9fc3e 100644 --- a/packageship/packageship/application/apps/package/function/install_depend.py +++ b/packageship/packageship/application/apps/package/function/install_depend.py @@ -20,6 +20,7 @@ class InstallDepend(): __search_list: Contain the binary packages searched in the next loop binary_dict: Contain all the binary packages info and operation __search_db: A object of database which would be connected + not_found_components: Contain the package not found components changeLog: """ #pylint: disable = too-few-public-methods @@ -32,6 +33,7 @@ class InstallDepend(): self.db_list = db_list self.__search_db = SearchDB(db_list) + self.not_found_components = set() def query_install_depend(self, binary_list, history_dicts=None): """ @@ -51,12 +53,13 @@ class InstallDepend(): 'install' ] ]} + not_found_components:Set of package not found components Raises: """ if not self.__search_db.db_object_dict: - return ResponseCode.DIS_CONNECTION_DB, None + return ResponseCode.DIS_CONNECTION_DB, None, set() if not binary_list: - return ResponseCode.INPUT_NONE, None + return ResponseCode.INPUT_NONE, None, set() for binary in binary_list: if binary: self.__search_list.append(binary) @@ -64,7 +67,7 @@ class InstallDepend(): LOGGER.logger.warning("There is a NONE in input value:" + str(binary_list)) while self.__search_list: self.__query_single_install_dep(history_dicts) - return ResponseCode.SUCCESS, self.binary_dict.dictionary + return ResponseCode.SUCCESS, self.binary_dict.dictionary, self.not_found_components def __query_single_install_dep(self, history_dicts): """ @@ -75,7 +78,8 @@ class InstallDepend(): response_code: response code Raises: """ - result_list = set(self.__search_db.get_install_depend(self.__search_list)) + result_list, not_found_components = map(set, self.__search_db.get_install_depend(self.__search_list)) + self.not_found_components.update(not_found_components) for search in self.__search_list: if search not in self.binary_dict.dictionary: self.binary_dict.init_key(key=search, parent_node=[]) diff --git a/packageship/packageship/application/apps/package/function/searchdb.py b/packageship/packageship/application/apps/package/function/searchdb.py index fed2b753d6d17fe876cd505176097066c9d0b7bf..e977f7a20e825fb15986ad99881153a85235fe80 100644 --- a/packageship/packageship/application/apps/package/function/searchdb.py +++ b/packageship/packageship/application/apps/package/function/searchdb.py @@ -58,7 +58,8 @@ class SearchDB(): Args: binary_list: a list of binary package name Returns: - install depend list + list:install depend list + set:package not found components Raises: """ result_list = [] @@ -128,7 +129,7 @@ class SearchDB(): install_result = self._get_install_pro_in_other_database( provides_not_found) result_list.extend(install_result) - return result_list + return result_list, set(provides_not_found.keys()) else: continue except AttributeError as error_msg: @@ -141,7 +142,7 @@ class SearchDB(): for binary_name in search_set: result_list.append((return_tuple(None, None, None, binary_name, None, None), 'NOT FOUND')) - return result_list + return result_list, set(provides_not_found.keys()) def get_src_name(self, binary_name): """ @@ -181,6 +182,7 @@ class SearchDB(): Args: source_name_list: search package's name, database preority list Returns: + response code result_list: subpack tuple Raises: AttributeError: The object does not have this property @@ -196,18 +198,17 @@ class SearchDB(): return ResponseCode.INPUT_NONE, None for db_name, data_base in self.db_object_dict.items(): try: - name_in = literal_column('src_name').in_(search_set) - sql_com = text('''SELECT - NAME AS subpack_name, - src_name AS search_name, - version AS search_version + name_in = literal_column('name').in_(search_set) + sql_com = text(''' + SELECT + bin_pack.name AS subpack_name, + src.name AS search_name, + src.version AS search_version FROM - bin_pack - WHERE - {} - '''.format(name_in)) + (SELECT name,version FROM src_pack WHERE {}) src + LEFT JOIN bin_pack on src.name = bin_pack.src_name'''.format(name_in)) subpack_tuple = data_base.session. \ - execute(sql_com, {'src_name_{}'.format(i): v + execute(sql_com, {'name_{}'.format(i): v for i, v in enumerate(search_set, 1)}).fetchall() if subpack_tuple: for result in subpack_tuple: @@ -226,8 +227,6 @@ class SearchDB(): return_tuple = namedtuple( 'return_tuple', 'subpack_name search_version search_name') for search_name in search_set: - # LOGGER.logger.warning("Can't not find " + - # search_name + " subpack in all database") result_list.append( (return_tuple(None, None, search_name), 'NOT_FOUND')) return ResponseCode.SUCCESS, result_list @@ -310,8 +309,16 @@ class SearchDB(): if not_found_binary: for key, values in not_found_binary.items(): - LOGGER.logger.warning( - "CANNOT FOUND THE component" + key + " in all database") + for info in values: + obj = return_tuple( + info[0], + None, + None, + None, + 'NOT FOUND', + info[2] + ) + result_list.append(obj) return result_list def _get_install_pro_in_other_database(self, not_found_binary): @@ -362,9 +369,18 @@ class SearchDB(): del not_found_binary[result.req_name] if not not_found_binary: return result_list - # if not_found_binary: - # for key, values in not_found_binary.items(): - # LOGGER.logger.warning("CANNOT FOUND THE component" + key + " in all database") + if not_found_binary: + for key, values in not_found_binary.items(): + for info in values: + obj = return_tuple( + None, + None, + None, + info[0], + info[1], + info[2] + ) + result_list.append((obj, info[3])) return result_list def get_build_depend(self, source_name_li): @@ -376,7 +392,7 @@ class SearchDB(): all source pkg build depend list structure :[(search_name,source_name,bin_name,bin_version,db_name,search_version), (search_name,source_name,bin_name,bin_version,db_name,search_version),] - + set: package not found components name set Raises: AttributeError: The object does not have this property SQLAlchemyError: sqlalchemy error @@ -393,7 +409,7 @@ class SearchDB(): s_name_set = set(source_name_li) if not s_name_set: - return ResponseCode.PARAM_ERROR, None + return ResponseCode.PARAM_ERROR, set() provides_not_found = dict() build_list = [] @@ -465,7 +481,7 @@ class SearchDB(): build_result = self._get_binary_in_other_database( provides_not_found) build_list.extend(build_result) - return ResponseCode.SUCCESS, build_list + return ResponseCode.SUCCESS, build_list, set(provides_not_found.keys()) if s_name_set: build_result = self._get_binary_in_other_database( @@ -474,7 +490,7 @@ class SearchDB(): for source in s_name_set: LOGGER.logger.warning( "CANNOT FOUND THE source " + source + " in all database") - return ResponseCode.SUCCESS, build_list + return ResponseCode.SUCCESS, build_list, set(provides_not_found.keys()) def binary_search_database_for_first_time(self, binary_name): """ diff --git a/packageship/packageship/application/apps/package/function/self_depend.py b/packageship/packageship/application/apps/package/function/self_depend.py index 54def4496d5b078b6a274c300ed37abfe0a59ccd..3f51e2a72c64a82191336b23a07f7126f2ce18bb 100644 --- a/packageship/packageship/application/apps/package/function/self_depend.py +++ b/packageship/packageship/application/apps/package/function/self_depend.py @@ -33,6 +33,7 @@ class SelfDepend(): search_subpack_list: Contain the source packages searched subpack in the next loop withsubpack: withsubpack search_db: A object of database which would be connected + not_found_components: Contain the package not found components """ def __init__(self, db_list): """ @@ -47,6 +48,7 @@ class SelfDepend(): self.withsubpack = 0 self.db_list = db_list self.search_db = SearchDB(db_list) + self.not_found_components = set() def query_depend(self, packname, selfbuild, withsubpack, packtype='binary'): """ @@ -59,17 +61,18 @@ class SelfDepend(): Returns: binary_dict.dictionary: Contain all the binary packages info after searching source_dicts.dictionary: Contain all the source packages info after searching + not_found_components :Set of package not found components Raises: """ if not self.search_db.db_object_dict: - return ResponseCode.DIS_CONNECTION_DB, None, None + return ResponseCode.DIS_CONNECTION_DB, None, None, set() if not packname: return ResponseCode.INPUT_NONE self.withsubpack = withsubpack response_code = self.init_dict(packname, packtype) if response_code != ResponseCode.SUCCESS: - return response_code, self.binary_dict.dictionary, self.source_dicts.dictionary + return response_code, self.binary_dict.dictionary, self.source_dicts.dictionary, self.not_found_components for key, _ in self.binary_dict.dictionary.items(): self.search_install_list.append(key) @@ -85,7 +88,7 @@ class SelfDepend(): self.with_subpack() if self.search_build_list: self.query_build(selfbuild) - return response_code, self.binary_dict.dictionary, self.source_dicts.dictionary + return response_code, self.binary_dict.dictionary, self.source_dicts.dictionary, self.not_found_components def init_dict(self, packname, packtype): """ @@ -130,9 +133,10 @@ class SelfDepend(): Raises: """ self.result_tmp.clear() - _, self.result_tmp = \ + _, self.result_tmp, not_fd_com = \ install_depend(self.db_list).query_install_depend(self.search_install_list, self.binary_dict.dictionary) + self.not_found_components.update(not_fd_com) self.search_install_list.clear() for key, values in self.result_tmp.items(): if key in self.binary_dict.dictionary: @@ -199,13 +203,13 @@ class SelfDepend(): Returns: Raises: """ - _, self.result_tmp, _ = build_depend( + _, self.result_tmp, _, not_fd_com = build_depend( self.search_build_list, self.db_list, self_build=0, history_dict=self.binary_dict.dictionary ).build_depend_main() - + self.not_found_components.update(not_fd_com) self.search_build_list.clear() for key, values in self.result_tmp.items(): if not key: @@ -231,13 +235,13 @@ class SelfDepend(): Args: Returns: """ - _, self.result_tmp, source_dicts_tmp = build_depend( + _, self.result_tmp, source_dicts_tmp, not_fd_com = build_depend( self.search_build_list, self.db_list, self_build=1, history_dict=self.source_dicts.dictionary ).build_depend_main() - + self.not_found_components.update(not_fd_com) for key, values in self.result_tmp.items(): if not key: LOGGER.logger.warning("key is NONE for value = " + str(values)) diff --git a/packageship/packageship/application/apps/package/view.py b/packageship/packageship/application/apps/package/view.py index 807b45151efa0f8bff773b3729c9aeccc269c6e7..1c4b3d3b92d5e421bbd50ca25da792030d6266f3 100644 --- a/packageship/packageship/application/apps/package/view.py +++ b/packageship/packageship/application/apps/package/view.py @@ -38,7 +38,9 @@ from .serialize import SelfDependSchema from .serialize import have_err_db_name LOGGER = Log(__name__) -#pylint: disable = no-self-use + + +# pylint: disable = no-self-use class Packages(Resource): @@ -215,16 +217,22 @@ class InstallDepend(Resource): ResponseCode.response_json(ResponseCode.DB_NAME_ERROR) ) - response_code, install_dict = \ + response_code, install_dict, not_found_components = \ installdepend(db_list).query_install_depend([pkg_name]) if not install_dict: return jsonify( ResponseCode.response_json(response_code) ) - + elif len(install_dict) == 1 and install_dict.get(pkg_name)[2] == 'NOT FOUND': + return jsonify( + ResponseCode.response_json(ResponseCode.PACK_NAME_NOT_FOUND) + ) return jsonify( - ResponseCode.response_json(ResponseCode.SUCCESS, data=install_dict) + ResponseCode.response_json(ResponseCode.SUCCESS, data={ + "install_dict": install_dict, + 'not_found_components': list(not_found_components) + }) ) @@ -282,12 +290,23 @@ class BuildDepend(Resource): build_ins = builddepend([pkg_name], db_list) - res_code, res_dict, _ = build_ins.build_depend_main() + res_code, res_dict, _, not_found_com = build_ins.build_depend_main() + if res_dict: + res_code = ResponseCode.SUCCESS + else: + return jsonify( + ResponseCode.response_json( + res_code + ) + ) return jsonify( ResponseCode.response_json( res_code, - data=res_dict if res_dict else None + data={ + 'build_dict': res_dict, + 'not_found_components': list(not_found_com) + } ) ) @@ -350,7 +369,7 @@ class SelfDepend(Resource): return jsonify( ResponseCode.response_json(ResponseCode.DB_NAME_ERROR) ) - response_code, binary_dicts, source_dicts = \ + response_code, binary_dicts, source_dicts, not_fd_components = \ self_depend(db_list).query_depend(pkg_name, int(self_build), int(with_sub_pack), pack_type) @@ -362,7 +381,8 @@ class SelfDepend(Resource): return jsonify( ResponseCode.response_json(ResponseCode.SUCCESS, data={ "binary_dicts": binary_dicts, - "source_dicts": source_dicts + "source_dicts": source_dicts, + "not_found_components": list(not_fd_components) }) ) diff --git a/packageship/packageship/application/initsystem/data_import.py b/packageship/packageship/application/initsystem/data_import.py index cda86a5c1016af7eb271a4f848b13f68f0e18693..1fda79f08fe0b0ba0395e2ceb93861de0c24e897 100644 --- a/packageship/packageship/application/initsystem/data_import.py +++ b/packageship/packageship/application/initsystem/data_import.py @@ -200,12 +200,8 @@ class InitDataBase(): raise FileNotFoundError("sqlite file {src} or {bin} does not exist, please \ check and try again".format(src=src_db_file, bin=bin_db_file)) # 3. Obtain temporary source package files and binary package files - _lifecycle_status_val = database_config.get('lifecycle') - if self.__save_data(src_db_file, - bin_db_file, - self.database_name, - _db_name, - _lifecycle_status_val): + if self.__save_data(database_config, + self.database_name): # Update the configuration file of the database database_content = { 'database_name': _db_name, @@ -266,7 +262,7 @@ class InitDataBase(): LOGGER.logger.error(sql_error) return None - def __save_data(self, src_db_file, bin_db_file, db_name, table_name, lifecycle_status_val): + def __save_data(self, database_config, db_name): """ integration of multiple data files @@ -278,6 +274,10 @@ class InitDataBase(): Raises: """ + src_db_file = database_config.get('src_db_file') + bin_db_file = database_config.get('bin_db_file') + table_name = database_config.get('dbname') + lifecycle_status_val = database_config.get('lifecycle') try: with DBHelper(db_name=src_db_file, db_type='sqlite:///', complete_route_db=True) \ as database: @@ -324,15 +324,6 @@ class InitDataBase(): if lifecycle_status_val == 'enable': InitDataBase._storage_packages(table_name, packages_datas) - @staticmethod - def __meta_model(table_name): - """ - The mapping relationship of the orm model - """ - model = type("packages", (Packages, DBHelper.BASE), { - '__tablename__': table_name}) - return model - @staticmethod def _storage_packages(table_name, package_data): """ @@ -744,8 +735,7 @@ class SqliteDatabaseOperations(): if not self.storage and os.path.exists(_db_file + '.db'): os.remove(_db_file + '.db') - # create a sqlite database - # if (self.is_datum and not os.path.exists(_db_file + '.db')) or not self.is_datum: + # create a sqlite database with DBHelper(db_name=_db_file) as database: try: if self.tables: diff --git a/packageship/packageship/pkgship.py b/packageship/packageship/pkgship.py index ea32b5276e37f7f2848ac4768668b000951c893e..be33ae096eb66939d3b0e5238483f9fe692630c9 100644 --- a/packageship/packageship/pkgship.py +++ b/packageship/packageship/pkgship.py @@ -10,6 +10,7 @@ import os import json import threading from json.decoder import JSONDecodeError + try: import argparse import requests @@ -209,11 +210,12 @@ class PkgshipCommand(BaseCommand): except Error: print('command error') - def parse_depend_package(self, response_data): + def parse_depend_package(self, response_data, params=None): """ Description: Parsing package data with dependencies Args: response_data: http request response content + params: Parameters passed in on the command line Returns: Summarized data table Raises: @@ -224,6 +226,12 @@ class PkgshipCommand(BaseCommand): if response_data.get('code') == ResponseCode.SUCCESS: package_all = response_data.get('data') if isinstance(package_all, dict): + if params: + if package_all.get("not_found_components"): + print("Problem: Not Found Components") + for not_found_com in package_all.get("not_found_components"): + print(" - nothing provides {} needed by {} ".format(not_found_com, params.packagename)) + package_all = package_all.get("build_dict") for bin_package, package_depend in package_all.items(): # distinguish whether the current data is the data of the root node @@ -753,7 +761,7 @@ class BuildDepCommand(PkgshipCommand): if response.status_code == 200: try: statistics_table = self.parse_depend_package( - json.loads(response.text)) + json.loads(response.text), params) except JSONDecodeError as json_error: LOGGER.logger.error(json_error) print(response.text) @@ -813,11 +821,12 @@ class InstallDepCommand(PkgshipCommand): cmd_params[0], nargs='*', default=None, help=cmd_params[1]) self.parse.set_defaults(func=self.do_command) - def __parse_package(self, response_data): + def __parse_package(self, response_data, params): """ Description: Parse the corresponding data of the package Args: response_data: http response data + params: Parameters passed in on the command line Returns: Raises: @@ -832,7 +841,11 @@ class InstallDepCommand(PkgshipCommand): if response_data.get('code') == ResponseCode.SUCCESS: package_all = response_data.get('data') if isinstance(package_all, dict): - for bin_package, package_depend in package_all.items(): + if package_all.get("not_found_components"): + print("Problem: Not Found Components") + for not_found_com in package_all.get("not_found_components"): + print(" - nothing provides {} needed by {} ".format(not_found_com, params.packagename)) + for bin_package, package_depend in package_all.get("install_dict").items(): # distinguish whether the current data is the data of the root node if isinstance(package_depend, list) and package_depend[-1][0][0] != 'root': @@ -895,13 +908,13 @@ class InstallDepCommand(PkgshipCommand): if response.status_code == 200: try: statistics_table = self.__parse_package( - json.loads(response.text)) + json.loads(response.text), params) except JSONDecodeError as json_error: LOGGER.logger.error(json_error) print(response.text) else: if getattr(self.table, 'rowcount'): - self.print_('query{} InstallDepend result display:'.format( + self.print_('query {} InstallDepend result display:'.format( params.packagename)) print(self.table) self.print_('statistics') @@ -1034,11 +1047,12 @@ class SelfBuildCommand(PkgshipCommand): return src_package_count - def __parse_package(self, response_data): + def __parse_package(self, response_data, params): """ Description: Parse the corresponding data of the package Args: response_data: http response data + params: Parameters passed in on the command line Returns: Summarized data table Raises: @@ -1053,6 +1067,10 @@ class SelfBuildCommand(PkgshipCommand): package_all = response_data.get('data') if isinstance(package_all, dict): # Parsing binary result data + if package_all.get("not_found_components"): + print("Problem: Not Found Components") + for not_found_com in package_all.get("not_found_components"): + print(" - nothing provides {} needed by {} ".format(not_found_com, params.packagename)) bin_package_count = self._parse_bin_package( package_all.get('binary_dicts')) @@ -1096,7 +1114,7 @@ class SelfBuildCommand(PkgshipCommand): if response.status_code == 200: try: statistics_table = self.__parse_package( - json.loads(response.text)) + json.loads(response.text), params) except JSONDecodeError as json_error: LOGGER.logger.error(json_error) print(response.text) diff --git a/packageship/test/common_files/conf.yaml b/packageship/test/common_files/conf.yaml index 190b6f7fe6ade916373e89630fa61f1892ac102d..1a2d9df2e30de2c6b8cc11de89ffcc4508e55324 100644 --- a/packageship/test/common_files/conf.yaml +++ b/packageship/test/common_files/conf.yaml @@ -2,9 +2,9 @@ dbname: mainline priority: 1 src_db_file: - status: enable + lifecycle: enable - bin_db_file: dbname: fedora30 priority: 2 src_db_file: - status: enable + lifecycle: enable diff --git a/packageship/test/common_files/correct_test_result_json/build_depend.json b/packageship/test/common_files/correct_test_result_json/build_depend.json index dd8788c85043a955fe44a0ecdd3e9e85e8a0da31..945d58fa1f8b3f0e117506c5a6de4976a6ac939c 100644 --- a/packageship/test/common_files/correct_test_result_json/build_depend.json +++ b/packageship/test/common_files/correct_test_result_json/build_depend.json @@ -6,84 +6,87 @@ "output": { "code": "2001", "data": { - "A_src": [ - "source", - "0.0.23b", - "mainline", - [ + "build_dict": { + "A_src": [ + "source", + "0.0.23b", + "mainline", [ - "root", - null + [ + "root", + null + ] ] - ] - ], - "B1": [ - "B", - "0.0.2", - "mainline", - [ + ], + "B1": [ + "B", + "0.0.2", + "mainline", [ - "A", - "build" + [ + "A", + "build" + ] ] - ] - ], - "C1": [ - "C", - "0.1", - "mainline", - [ + ], + "C1": [ + "C", + "0.1", + "mainline", [ - "A", - "build" - ], - [ - "A2", - "install" + [ + "A", + "build" + ], + [ + "A2", + "install" + ] ] - ] - ], - "A1": [ - "A", - "0.0.23b", - "mainline", - [ + ], + "A1": [ + "A", + "0.0.23b", + "mainline", [ - "B1", - "install" - ], - [ - "D1", - "install" + [ + "B1", + "install" + ], + [ + "D1", + "install" + ] ] - ] - ], - "A2": [ - "A", - "0.0.23b", - "mainline", - [ + ], + "A2": [ + "A", + "0.0.23b", + "mainline", [ - "A1", - "install" - ], - [ - "C1", - "install" + [ + "A1", + "install" + ], + [ + "C1", + "install" + ] ] - ] - ], - "D1": [ - "D", - "0.11", - "mainline", - [ + ], + "D1": [ + "D", + "0.11", + "mainline", [ - "A2", - "install" + [ + "A2", + "install" + ] ] ] - ] + }, + "not_found_components": [] }, "msg": "Successful Operation!" } diff --git a/packageship/test/common_files/correct_test_result_json/install_depend.json b/packageship/test/common_files/correct_test_result_json/install_depend.json index b6b5c818808e118ead1f04fb3e848b21481548f8..34d0982156ae0ff0cb22010998d4de46163de018 100644 --- a/packageship/test/common_files/correct_test_result_json/install_depend.json +++ b/packageship/test/common_files/correct_test_result_json/install_depend.json @@ -6,58 +6,61 @@ "output": { "code": "2001", "data": { - "A1": [ - "A", - "0.0.23b", - "mainline", - [ + "install_dict": { + "A1": [ + "A", + "0.0.23b", + "mainline", [ - "root", - null - ], - [ - "D1", - "install" + [ + "root", + null + ], + [ + "D1", + "install" + ] ] - ] - ], - "A2": [ - "A", - "0.0.23b", - "mainline", - [ - [ - "A1", - "install" - ], + ], + "A2": [ + "A", + "0.0.23b", + "mainline", [ - "C1", - "install" + [ + "A1", + "install" + ], + [ + "C1", + "install" + ] ] - ] - ], - "C1": [ - "C", - "0.1", - "mainline", - [ + ], + "C1": [ + "C", + "0.1", + "mainline", [ - "A2", - "install" + [ + "A2", + "install" + ] ] - ] - ], - "D1": [ - "D", - "0.11", - "mainline", - [ + ], + "D1": [ + "D", + "0.11", + "mainline", [ - "A2", - "install" + [ + "A2", + "install" + ] ] ] - ] + }, + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -69,69 +72,72 @@ "output": { "code": "2001", "data": { - "A1": [ - "A", - "0.0.23b", - "mainline", - [ + "install_dict": { + "A1": [ + "A", + "0.0.23b", + "mainline", [ - "D1", - "install" + [ + "D1", + "install" + ] ] - ] - ], - "A2": [ - "A", - "0.0.23b", - "mainline", - [ + ], + "A2": [ + "A", + "0.0.23b", + "mainline", [ - "A1", - "install" - ], - [ - "C1", - "install" + [ + "A1", + "install" + ], + [ + "C1", + "install" + ] ] - ] - ], - "C1": [ - "C", - "0.1", - "mainline", - [ + ], + "C1": [ + "C", + "0.1", + "mainline", [ - "A2", - "install" + [ + "A2", + "install" + ] ] - ] - ], - "D1": [ - "D", - "0.11", - "mainline", - [ + ], + "D1": [ + "D", + "0.11", + "mainline", [ - "D2", - "install" - ], - [ - "A2", - "install" + [ + "D2", + "install" + ], + [ + "A2", + "install" + ] ] - ] - ], - "D2": [ - "D", - "0.11", - "mainline", - [ + ], + "D2": [ + "D", + "0.11", + "mainline", [ - "root", - null + [ + "root", + null + ] ] ] - ] + }, + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -143,17 +149,20 @@ "output": { "code": "2001", "data": { - "C2": [ - "C", - "0.1", - "mainline", - [ + "install_dict": { + "C2": [ + "C", + "0.1", + "mainline", [ - "root", - null + [ + "root", + null + ] ] ] - ] + }, + "not_found_components": [] }, "msg": "Successful Operation!" } diff --git a/packageship/test/common_files/correct_test_result_json/self_depend.json b/packageship/test/common_files/correct_test_result_json/self_depend.json index cc69ce695411e5949e805f051c6595bf0bb108eb..6fee2dc84119c21efe60c92bb08e46994ea7d8c7 100644 --- a/packageship/test/common_files/correct_test_result_json/self_depend.json +++ b/packageship/test/common_files/correct_test_result_json/self_depend.json @@ -123,7 +123,8 @@ "mainline", "0.11" ] - } + }, + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -264,7 +265,8 @@ "mainline", "0.11" ] - } + }, + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -421,7 +423,8 @@ "mainline", "0.11" ] - } + }, + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -583,7 +586,9 @@ "mainline", "0.11" ] - } + }, + + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -753,7 +758,9 @@ "mainline", "0.11" ] - } + }, + + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -892,7 +899,9 @@ "mainline", "0.11" ] - } + }, + + "not_found_components": [] }, "msg": "Successful Operation!" } @@ -1036,7 +1045,9 @@ "mainline", "0.11" ] - } + }, + + "not_found_components": [] }, "msg": "Successful Operation!" } diff --git a/packageship/test/test_module/dependent_query_tests/test_install_depend.py b/packageship/test/test_module/dependent_query_tests/test_install_depend.py index 81ddf98bd5a7135cdbf4bae74ffddf8ff8b6fb5f..9b9280be69fb930a2ec157e7cfd6d6e254011057 100644 --- a/packageship/test/test_module/dependent_query_tests/test_install_depend.py +++ b/packageship/test/test_module/dependent_query_tests/test_install_depend.py @@ -89,17 +89,17 @@ class TestInstallDepend(ReadTestBase): resp_dict = json.loads(resp.data) self.assertIn("code", resp_dict, msg="Error in data format return") - self.assertEqual(ResponseCode.SUCCESS, + self.assertEqual(ResponseCode.PACK_NAME_NOT_FOUND, resp_dict.get("code"), msg="Error in status code return") self.assertIn("msg", resp_dict, msg="Error in data format return") - self.assertEqual(ResponseCode.CODE_MSG_MAP.get(ResponseCode.SUCCESS), + self.assertEqual(ResponseCode.CODE_MSG_MAP.get(ResponseCode.PACK_NAME_NOT_FOUND), resp_dict.get("msg"), msg="Error in status prompt return") self.assertIn("data", resp_dict, msg="Error in data format return") - self.assertIsNotNone(resp_dict.get("data"), msg="Error in data information return") + self.assertIsNone(resp_dict.get("data"), msg="Error in data information return") resp = self.client.post("/packages/findInstallDepend", data=json.dumps({"binaryName": "A1", diff --git a/packageship/test/write_test.py b/packageship/test/write_test.py index dded68e6469b76a7db4d0668d77c0a647e958057..7d12f13d69e97fb1a485c045f6ce8efa9cf862c4 100644 --- a/packageship/test/write_test.py +++ b/packageship/test/write_test.py @@ -19,8 +19,8 @@ def write_data_tests(): suite = unittest.TestSuite() classes = [ - # TestDeleteRepodatas, - # TestBatchUpdatePackage, + TestDeleteRepodatas, + TestBatchUpdatePackage, TestIssueCatch ] for cls in classes: