test_01login.py
import requests
def test_login():
url = "http://192.168.3.4:8888/api/login"
# 账号密码正确
payload = '{"username":"admin","password":"admin","recaptcha":""}'
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=payload, headers=headers)
assert response.status_code == 200
test_02login.py
import requests
def test_login():
url = "http://192.168.3.4:8888/api/login"
# 密码错误
payload = '{"username":"admin","password":"123456","recaptcha":""}'
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=payload, headers=headers)
assert response.status_code == 200
本文通过两个测试用例验证了filebrowser网盘系统的登录功能。首先使用正确的用户名和密码进行登录,期望返回状态码200;接着尝试错误的密码登录,同样期待返回状态码200,以验证系统的异常处理机制。
3779

被折叠的 条评论
为什么被折叠?



