Пример #1
0
def test_register_pass(pass_data, url, baserquests, db):
    print(f"测试数据为:{pass_data['casedata']}")
    print(f"期望结果为:{pass_data['expect']}")
    phone = pass_data['casedata']['mobilephone']
    # 初始化环境
    DbOp.deleteUser(db, phone)
    # 发送请求
    r = Member.register(url, baserquests, pass_data['casedata']).json()
    assert r['status'] == pass_data['expect']['status']
    assert r['code'] == pass_data['expect']['code']
    assert r['msg'] == pass_data['expect']['msg']
    # 2.检查实际有没有注册成功(1、查数据库;2、获取用户列表;3、用注册的用户登录)
    r = Member.getList(url, baserquests)
    assert phone in r.text
    # 清理环境,根据手机号删除用户
    DbOp.deleteUser(db, phone)
Пример #2
0
def test_pass(url, baserquests, login_data, register):

    print(f"测试数据为:{login_data['casedata']}")
    print(f"期望结果为:{login_data['expect']}")
    r = Member.login(url, baserquests, login_data['casedata']).json()
    assert r['status'] == login_data['expect']['status']
    assert r['code'] == login_data['expect']['code']
    assert r['msg'] == login_data['expect']['msg']
Пример #3
0
def register(setup_data, url, baserquests, db):
    # 注册
    phone = setup_data['casedata']['mobilephone']
    DbOp.deleteUser(db, phone)
    r = Member.register(url, baserquests, setup_data['casedata'])
    yield
    # 删除注册用户
    DbOp.deleteUser(db, phone)
Пример #4
0
def test_register_fail(fail_data, url, baserquests):
    print(f"测试数据为:{fail_data['casedata']}")
    print(f"期望结果为:{fail_data['expect']}")
    # 发送请求
    r = Member.register(url, baserquests, fail_data['casedata']).json()
    # 检查结果
    assert r['status'] == fail_data['expect']['status']
    assert r['code'] == fail_data['expect']['code']
    assert r['msg'] == fail_data['expect']['msg']
Пример #5
0
def register(url, baserquests, setup_data, db):
    phone = setup_data['casedata']['mobilephone']
    DbOp.deleteUser(db, phone)
    Member.register(url, baserquests, setup_data['casedata'])
    yield
    DbOp.deleteUser(db, phone)