02Pytest测试网盘登录

01本地搭建web网盘filebrowser

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
02Pytest测试网盘登录_第1张图片

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
02Pytest测试网盘登录_第2张图片

你可能感兴趣的:(02Pytest测试网盘登录)