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
![13054248-1496253505ae1d50.png](https://i-blog.csdnimg.cn/blog_migrate/879b10713a8ec6dba97b5f735c0f4f33.webp?x-image-process=image/format,png)
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
![13054248-10c6beba7c48d10c.png](https://i-blog.csdnimg.cn/blog_migrate/e13a955b6b63bc27a6dc1e0f7e3e3383.webp?x-image-process=image/format,png)