Exemplo n.º 1
0
def release_overview_func():
    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="release_overview")

        if not req_data:
            logger.error("json body is empty")
            return json.jsonify(response_payload.bulid("999900001"))

    try:
        releaseVo.validate(api_type="release_overview")
        service = ReleaseService(app_context)
        result, cost_time = service.get_release_overview()
        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"))
Exemplo n.º 2
0
 def test_dependency_overview(self):
     """
     1.測試 拿取所有依賴套件的資料
     2.正常回傳
     """
     request_data_user = {"user": "******"}
     release_vo = ReleaseVo()
     release_vo.value_of_import(request_data_user, api_type="dependency_overview")
     release_vo.validate(api_type="dependency_overview")
     service = ReleaseService(app_context)
     result, cost_time = service.get_release_overview()