Exemplo n.º 1
0
def monkey_device_status_all_handler():
    limit, offset = parse_list_args()

    monkey_id = request.args.get('monkey_id')

    if monkey_id:
        data = MonkeyDeviceStatusBusiness.query_json_by_monkey_id(monkey_id)
        return json_list_render(0, data, limit, offset)

    monkeys = MonkeyDeviceStatusBusiness.query_all_json(limit, offset)
    return {"code": 0, "data": monkeys}
Exemplo n.º 2
0
def monkey_cancel_status_handler():
    """
    @api {get} /v1/monkey/cancel 查询 monkey 测试中断状态
    @apiName GetCancelMonkeyStatus
    @apiGroup 自动化测试
    @apiDescription 查询 monkey 测试中断状态
    @apiParam {int} [monkey_id] Monkey ID
    @apiParam {int} [task_id] 具体设备测试项目的 ID
    @apiParamExample {json} Request-Example:
    {
        "task_id": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": {
            "cancel_status": 0,
            "id": 56
        },
        "message": "ok"
    }
    """
    task_id = request.args.get('task_id')
    if task_id:
        data = MonkeyDeviceStatusBusiness.query_cancel_status_by_id(task_id)
        return dict(data=data)
    else:
        raise FieldMissingException('task_id is required')
Exemplo n.º 3
0
def monkey_device_status_update_handler(id):
    current_app.logger.info(id)
    if id is None:
        return json_detail_render(101, [], "无效的id")
    (process, activity_count, activity_tested_count,
     activity_all, activity_tested, anr_count, crash_count, crash_rate, exception_count, exception_run_time,
     setup_install_app_status, setup_uninstall_app_status, start_app_status, begin_time, login_app_status,
     running_status, teardown_uninstall_app_status, end_time, run_time, device_connect_status, screen_lock_status,
     current_stage, running_error_reason, mobile_resolution) = parse_json_form('monkey_device_status_update')
    ret, msg = MonkeyDeviceStatusBusiness.update(id=id, process=process, activity_count=activity_count,
                                                 activity_tested_count=activity_tested_count, activity_all=activity_all,
                                                 activity_tested=activity_tested, anr_count=anr_count,
                                                 crash_count=crash_count, exception_count=exception_count,
                                                 exception_run_time=exception_run_time,
                                                 setup_install_app_status=setup_install_app_status,
                                                 begin_time=begin_time, start_app_status=start_app_status,
                                                 setup_uninstall_app_status=setup_uninstall_app_status,
                                                 login_app_status=login_app_status, end_time=end_time,
                                                 running_status=running_status, run_time=run_time,
                                                 teardown_uninstall_app_status=teardown_uninstall_app_status,
                                                 device_connect_status=device_connect_status,
                                                 screen_lock_status=screen_lock_status, current_stage=current_stage,
                                                 running_error_reason=running_error_reason,
                                                 mobile_resolution=mobile_resolution)
    response = {
        "code": ret,
        "data": [],
        "message": msg
    }
    return response