示例#1
0
def test_register_repeat(repeat_data, url, db, base_requests):
    print(f"执行已注册的测试用例,测试数据为:{repeat_data}")
    r = Member().register(url, base_requests, repeat_data["data"])
    # assert str(repeat_data["expect"]["msg"])==str(r.json()["msg"])
    # assert str(repeat_data["expect"]["msg"]) == str(r.json()["msg"])
    # assert str(repeat_data["expect"]["msg"]) == str(r.json()["msg"])
    Assert().equal(repeat_data['expect'], r.json(), "msg,status,code")
示例#2
0
def register(setup_data, db, url, base_requests):
    # 注册成功
    r = Member().register(url, base_requests, setup_data["data"])
    Assert().equal(setup_data['expect'], r.json(), "msg,status,code")
    yield
    # 清理注册用户
    DbOp().delete_user(db, setup_data["data"]["mobilephone"])
示例#3
0
def test_register_success(success_data, url, db, base_requests):
    print(f"执行注册成功的用例,测试数据为:{success_data}")
    DbOp().delete_user(db, success_data["data"]["mobilephone"])
    r = Member().register(url, base_requests, success_data["data"])
    # assert str(success_data["expect"]["msg"])==str(r.json()["msg"])
    # assert str(success_data["expect"]["code"]) == str(r.json()["code"])
    # assert str(success_data["expect"]["status"]) == str(r.json()["status"])
    Assert().equal(success_data['expect'], r.json(), "msg,status,code")
示例#4
0
def test_register_fail(fail_data, url, base_requests):
    print(f"执行注册失败的用例,测试数据为:{fail_data}")
    r = Member().register(url, base_requests, fail_data["data"])
    print(r.text)
    # assert str(fail_data["expect"]["msg"])==str(r.json()["msg"])
    # assert str(fail_data["expect"]["code"]) == str(r.json()["code"])
    # assert str(fail_data["expect"]["status"]) == str(r.json()["status"])
    Assert().equal(fail_data['expect'], r.json(), "msg,status,code")
示例#5
0
def test_register_fail(fail_data, url, base_requests):
    print(f"执行注册失败的用例,测试数据为:{fail_data}")
    # conftest.py
    r = Member().register(url, base_requests, fail_data['data'])
    # assert str(fail_data['expect']['msg']) == str(r.json()['msg'])
    # assert str(fail_data['expect']['status']) == str(r.json()['status'])
    # assert str(fail_data['expect']['code']) == str(r.json()['code'])
    Assert().equal(fail_data['expect'], r.json(), "msg,status,code")
def test_register_success(success_data,url,db,base_requests):
    print(f"执行注册成功的用例,测试数据为:{success_data}")
    #环境初始化
    DbOp().delete_user(db,success_data['data']['mobilephone'])
    r = Member().register(url,base_requests,success_data['data'])
    print(r.text)
    # assert str(success_data['expect']['msg']) == str(r.json()['msg'])
    # assert str(success_data['expect']['status']) == str(r.json()['status'])
    # assert str(success_data['expect']['code']) == str(r.json()['code'])
    Assert().equal(success_data['expect'],r.json(),"msg,status,code")
示例#7
0
def test_login(register, url, base_requests,login_data):
    # print(f"执行登录失败的用例,测试数据为:{login_data}")
    r = Member().login(url, base_requests, login_data["data"])
    Assert().equal(login_data['expect'], r.json(), "msg,status,code")
示例#8
0
def test_login(url, base_requests, register, login_data):
    r = Member().login(url, base_requests, login_data['data'])
    Assert().equal(login_data['expect'], r.json(), "msg,status,code")
示例#9
0
def test_login_success(success_data,url,base_requests):
    print(f"执行登录成功的用例,测试数据为:{success_data}")
    r = Member().login(url,base_requests,success_data['data'])
    print(r.text)
    Assert().equal(success_data['expect'],r.json(),"msg,status,code")
示例#10
0
def test_login_fail(fail_data,url,base_requests):
    print(f"执行登录失败的用例,测试数据为:{fail_data}")
    r = Member().login(url,base_requests,fail_data['data'])
    print(r.text)
    Assert().equal(fail_data['expect'],r.json(),"msg,status,code")
示例#11
0
def register(setup_data, db, url, base_requests):
    # 注册用户
    r = Member().register(url, base_requests, setup_data["data"])
    yield
    # 删除注册用户
    DbOp().delete_user(db, setup_data["data"]["mobilephone"])
示例#12
0
def test_register_repeat(repeat_data, url, db, base_requests):
    print(f"执行重复注册的用例,测试数据为:{repeat_data}")
    r = Member().register(url, base_requests, repeat_data['data'])
    print(r.text)