def product_history_release_dep_info_fail(self): objectType = "product" request = request_data_for_history_info() release_vo = ReleaseVo() release_vo.value_of_import(request, api_type="history_info") release_vo.validate(api_type="history_info") service = ReleaseService(app_context) service.get_release_history_info(objectType, release_vo)
def history_info_func(objectType): app_context = current_app.config["app_context"] response_payload = ReponsePayloadBulider(app_context.messages) if request.method == "POST": req_data = request.get_json() releaseVo = ReleaseVo() releaseVo.value_of_import(req_data, api_type="history_info") if not req_data: logger.error("json body is empty") return json.jsonify(response_payload.bulid("999900001")) try: releaseVo.validate(api_type="history_info") service = ReleaseService(app_context) result, cost_time = service.get_release_history_info( objectType, releaseVo) return json.jsonify( response_payload.bulid("996600001", cost_time=cost_time, data=result)) except CommonRuntimeException as crex: logger.error(traceback.format_exc()) return json.jsonify((response_payload.bulid_from_exception(crex))) except AssertionError as ae: return json.jsonify((response_payload.bulid(ae.args[0]))) except: logger.error(traceback.format_exc()) return json.jsonify(response_payload.bulid("999999999"))
def test_project_history_release_dep_info_success(self): """ 1.測試 拿取專案所依賴的服務或套件歷史紀錄 2.正常回傳 """ objectType = "project" request = request_data_for_history_info() release_vo = ReleaseVo() release_vo.value_of_import(request, api_type="history_info") release_vo.validate(api_type="history_info") service = ReleaseService(app_context) check_history_release_dep_info_patch = patch.object(ReleaseDao, "get_data_by_object_id", side_effect=self.mock_history_release_info_success) check_history_release_dep_info_patch.start() result, cost_time = service.get_release_history_info(objectType, release_vo) check_history_release_dep_info_patch.stop()