Exemplo n.º 1
0
def test_denglu(test_zhuce, url, baserequests, fail_denglu):
    dengluFail = Member.login(url, baserequests, fail_denglu['canshu'])
    print(dengluFail.text)
    assert str(dengluFail.json()['msg']) == str(fail_denglu['jieguo']['msg'])
    assert str(dengluFail.json()['status']) == str(
        fail_denglu['jieguo']['status'])
    assert str(dengluFail.json()['code']) == str(fail_denglu['jieguo']['code'])
Exemplo n.º 2
0
def test_register_fail(fail_data, url, baserequests):
    print(f"测试数据为:{fail_data['casedata']}")
    print(f"测试数据为:{fail_data['expect']}")
    r = Member.register(url, baserequests, fail_data['casedata'])
    print(r.text)
    assert str(r.json()['msg']) == str(fail_data['expect']['msg'])
    assert str(r.json()['status']) == str(fail_data['expect']['status'])
    assert str(r.json()['code']) == str(fail_data['expect']['code'])
Exemplo n.º 3
0
def test_register_pass(pass_data, url, baserequests, 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'])
    print(r.text)
    #检查响应结果
    assert str(r.json()['msg']) == str(pass_data['expect']['msg'])
    assert str(r.json()['status']) == str(pass_data['expect']['status'])
    assert str(r.json()['code']) == str(pass_data['expect']['code'])
    #检查实际有没有注册成功
    r = Member.getList(url, baserequests)
    assert phone in r.text
    #清理环境,根据手机号删除注册用户
    DbOp.deleteUser(db, phone)
Exemplo n.º 4
0
def test_fail_denglu(pass_data,fail_denglu,url,baserequests,db,pass_denglu):
    print(f"测试数据为:{pass_data['casedata']}")
    print(f"测试数据为:{pass_data['expect']}")
    print(f"测试数据为:{fail_denglu['canshu']}")
    print(f"测试数据为:{fail_denglu['jieguo']}")

    phone=pass_data['casedata']["mobilephone"]
    #初始化数据防止已有人注册过了
    DbOp.deleteUser(db, phone)
    #发送请求
    zhuce=Member.register(url, baserequests, pass_data['casedata'])
    print("注册成功")

    dengluFail=Member.login(url, baserequests, fail_denglu['canshu'])
    print(dengluFail.text)
    assert str(dengluFail.json()['msg']) == str(fail_denglu['jieguo']['msg'])
    assert str(dengluFail.json()['status']) == str(fail_denglu['jieguo']['status'])
    assert str(dengluFail.json()['code']) == str(fail_denglu['jieguo']['code'])
Exemplo n.º 5
0
def register(login_setup, url, baserequests, db):
    #注册
    phone = login_setup['casedata']["mobilephone"]
    #初始化数据防止已有人注册过了
    DbOp.deleteUser(db, phone)
    zhuce = Member.register(url, baserequests, login_setup['casedata'])
    print("注册成功")
    yield
    #删除注册用户
    DbOp.deleteUser(db, phone)
Exemplo n.º 6
0
def test_zhuce(pass_data, db, url, baserequests):
    phone = pass_data['casedata']["mobilephone"]
    #初始化数据防止已有人注册过了
    DbOp.deleteUser(db, phone)
    #发送请求
    zhuce = Member.register(url, baserequests, pass_data['casedata'])
    print("注册成功")
    yield
    #删除注册用户
    DbOp.deleteUser(db, phone)
Exemplo n.º 7
0
def test_login(register, login_data, url, baserequests):
    r = Member.login(url, baserequests, login_data['casedata'])
    assert r.json()['msg'] == login_data['expect']['msg']