Пример #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(url, base_requests, setup_data, db):
    #注册用户
    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 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"])
Пример #4
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")
Пример #5
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")
Пример #6
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")
Пример #7
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'])
    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")
Пример #8
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")
Пример #9
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")
Пример #10
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")
Пример #11
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")
Пример #12
0
def test_login(login_data, url, register, base_requests):
    # 登录的测试逻辑
    print(f"执行登录的用例,测试数据为{login_data}")
    r = Member().login(url, base_requests, login_data['data'])
    # 断言
    Assert().equal(login_data['expect'], r.json(), "msg,status,code")