项目测试Wikis门户_用户接口

Posted figsprite

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了项目测试Wikis门户_用户接口相关的知识,希望对你有一定的参考价值。

####1.登录

/user/login.do post(代码需要post方式请求),开放get,方便调试

request

username,password

response

fail

{
    "status": 1,
    "msg": "密码错误"
}

success

{
    "status": 0,
    "data": {
        "id": 12,
        "username": "aaa",
        "email": "[email protected]",
        "phone": null,
        "role": 0,
        "createTime": 1479048325000,
        "updateTime": 1479048325000
    }
}

####2.注册 /user/register.do

request

username,password,email,phone,question,answer

response

success

{
    "status": 0,
    "msg": "校验成功"
}

fail

{
    "status": 1,
    "msg": "用户已存在"
}

####3.检查用户名是否有效

/user/check_valid.do

/check_valid.do?str=admin&type=username就是检查用户名。

request

str,type
str可以是用户名也可以是email。对应的type是username和email

response

success

{
    "status": 0,
    "msg": "校验成功"
}

fail

{
    "status": 1,
    "msg": "用户已存在"
}


####4.获取登录用户信息 /user/get_user_info.do

request

无参数

response

success

{
    "status": 0,
    "data": {
        "id": 12,
        "username": "aaa",
        "email": "[email protected]",
        "phone": null,
        "role": 0,
        "createTime": 1479048325000,
        "updateTime": 1479048325000
    }
}

fail

{
    "status": 1,
    "msg": "用户未登录,无法获取当前用户信息"
}


####5.忘记密码 /user/forget_get_question.do

localhost:8080/user/forget_get_question.do?username=geely

request

username

response

success

{
    "status": 0,
    "data": "这里是问题"
}

fail

{
    "status": 1,
    "msg": "该用户未设置找回密码问题"
}

####6.提交问题答案 /user/forget_check_answer.do

localhost:8080/user/forget_check_answer.do?username=aaa&question=aa&answer=sss

request

username,question,answer

response

正确的返回值里面有一个token,修改密码的时候需要用这个。传递给下一个接口

success

{
    "status": 0,
    "data": "531ef4b4-9663-4e6d-9a20-fb56367446a5"
}

fail

{
    "status": 1,
    "msg": "问题答案错误"
}

####7.忘记密码的重设密码 /user/forget_reset_password.do

localhost:8080/user/forget_reset_password.do?username=aaa&passwordNew=xxx&forgetToken=531ef4b4-9663-4e6d-9a20-fb56367446a5

request

username,passwordNew,forgetToken

response

success

{
    "status": 0,
    "msg": "修改密码成功"
}

fail

{
    "status": 1,
    "msg": "修改密码操作失效"
}

{
    "status": 1,
    "msg": "token已经失效"
}

####8.登录中状态重置密码 /user/reset_password.do

request

passwordOld,passwordNew

response

success

{
    "status": 0,
    "msg": "修改密码成功"
}

fail

{
    "status": 1,
    "msg": "旧密码输入错误"
}

####9.登录状态更新个人信息 /user/update_information.do

request

email,phone,question,answer

response

success

{
    "status": 0,
    "msg": "更新个人信息成功"
}

fail

{
    "status": 1,
    "msg": "用户未登录"
}

####10.获取当前登录用户的详细信息,并强制登录 /user/get_information.do

request

无参数

response

success

{
    "status": 0,
    "data": {
        "id": 1,
        "username": "admin",
        "password": "",
        "email": "[email protected]",
        "phone": "13800138000",
        "question": "question",
        "answer": "answer",
        "role": 1,
        "createTime": 1478422605000,
        "updateTime": 1491305256000
    }
}

fail

{
    "status": 10,
    "msg": "用户未登录,无法获取当前用户信息,status=10,强制登录"
}


####11.退出登录 /user/logout.do

request

response

success

{
    "status": 0,
    "msg": "退出成功"
}

fail

{
    "status": 1,
    "msg": "服务端异常"
}

####模板

/user/.do

request

k

response

success

k

fail

k

以上是关于项目测试Wikis门户_用户接口的主要内容,如果未能解决你的问题,请参考以下文章

Express实战 - 应用案例- realworld-API - 路由设计 - mongoose - 数据验证 - 密码加密 - 登录接口 - 身份认证 - token - 增删改查API(代码片段

Flask 编写http接口api及接口自动化测试

Java电商项目-6.实现门户首页数据展示_Redis数据缓存

JMeter接口测试-Include控制器

多测师拱墅校区肖sir_高级金牌讲师_接口测试之接口文档和接口用例

《果然新鲜》电商项目(27)- 门户界面