Esempio 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'])
Esempio n. 2
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'])
def test_login(register, login_data, url, baserequests):
    r = Member.login(url, baserequests, login_data['casedata'])
    assert r.json()['msg'] == login_data['expect']['msg']