Example #1
0
def register(db):
    # 连接
    global connent
    connent = DbOp.connent(db)
    yield
    # 断开
    DbOp.disconnect(connent)
Example #2
0
def register(pass_data, url, baserequests, db):
    # 注册
    phone = pass_data['casedata']['mobilephone']
    DbOp.deleteUser(db, phone)
    Member.register(url, baserequests, pass_data['casedata'])
    yield
    #删除注册用户
    DbOp.deleteUser(db, phone)
Example #3
0
def test_register_repeat(repet_data, url, db, baserequests):
    print(f"预测结果为: {repet_data['casedata']}")
    print(f"预测结果为: {repet_data['expect']}")
    phone = repet_data['casedata']['mobilephone']
    DbOp.deleteUser(db, phone)
    # 发送请求
    r = Member.register(url, baserequests, repet_data['casedata'])
    r = Member.register(url, baserequests, repet_data['casedata'])
    # 检查响应
    assert r.json()['msg'] == repet_data['expect']['msg']
    assert r.json()['status'] == repet_data['expect']['status']
    assert r.json()['code'] == repet_data['expect']['code']
    DbOp.deleteUser(db, phone)
Example #4
0
def test_login_pass(register, pass_data, url, db, baserequests):
    phone = pass_data['casedata']['mobilephone']
    # 初始化环境
    DbOp.deleteUser(connent, phone)
    # 发送请求
    Member.register(url, baserequests, pass_data['casedata'])
    login = Member.login(url, baserequests, pass_data['casedata'])
    # 检查响应结果
    assert str(login.json()['msg']) == str(pass_data['expect']['msg'])
    assert str(login.json()['status']) == str(pass_data['expect']['status'])
    assert str(login.json()['code']) == str(pass_data['expect']['code'])
    # 清理环境
    DbOp.deleteUser(connent, phone)
Example #5
0
def test_register_pass(pass_data, baserequests, url, db):
    print(f"测试数据为:{pass_data['casedata']}")
    print(f"预期结果为:{pass_data['expect']}")
    phone = pass_data['casedata']['mobilephone']
    #初始化环境确保环境中没有应县本次执行的数据
    DbOp.deleteUser(db, phone)
    # 发送请求
    r = Member.register(url, baserequests, pass_data['casedata'])
    # 检查响应的结果
    assert r.json()['code'] == pass_data['expect']['code']
    assert r.json()['msg'] == pass_data['expect']['msg']
    # 检查实际有没有注册成功,
    r = Member.getList(url, baserequests)

    # 清理环境,根据手机号删除注册用户
    DbOp.deleteUser(db,phone)
Example #6
0
def test_register_pass(pass_data, url, db, baserequests):
    print(f"预测结果为:{pass_data['casedata']}")
    print(f"预测结果为:{pass_data['expect']}")
    phone = pass_data['casedata']['mobilephone']
    # 初始化环境,确保环境中没有影响本次执行的数据
    DbOp.deleteUser(db, phone)
    # 发送请求
    r = Member.register(url, baserequests, pass_data['casedata'])
    # 检查响应结果
    assert r.json()['msg'] == pass_data['expect']['msg']
    assert r.json()['status'] == pass_data['expect']['status']
    assert r.json()['code'] == pass_data['expect']['code']
    # 2、检查实际有没有注册成功(1、查数据库,2、获取用户列表,3、用注册的用户登录)
    r = Member.getlist(url, baserequests)
    assert str(phone) in r.text
    # 清理环境、根据手机号删除注册用户
    DbOp.deleteUser(db, phone)
Example #7
0
def register(setup_data, url, baserequests, db):
    connent = DbOp.connent(db)
    # 注册
    phone = setup_data['casedata']['mobilephone']
    DbOp.deleteUser(connent, phone)
    Member.register(url, baserequests, setup_data['casedata'])
    yield
    # 删除
    DbOp.deleteUser(connent, phone)
    DbOp.disconnect(connent)