def baserequests(): return BaseRequests()
''' def register(url, baserequests, data): ''' 注册接口 :param url: 环境信息,比如http://jy001:8081/ :param baserequests: BaseRequests的实例 :param data:注册的测试数据 :return: 响应信息 ''' url = url + "futureloan/mvc/api/member/register" r = baserequests.post(url, data=data) return r def login(url, baserequests, data): url = url + "futureloan/mvc/api/member/login" r = baserequests.post(url, data=data) return r # 测试代码 if __name__ == '__main__': from ZongHe.caw.BaseRequests import BaseRequests b = BaseRequests() canshu = {'mobilephone': "13324563854", "pwd": "123456"} r = register("http://jy001:8081/", b, canshu) print(r.text)
return r def login(url, baserequests, data): ''' 发送登录接口 :param url: http://jy001:8081/ :param baserequests: 是baserequests的一个实例 :param data: 登录接口参数 :return: 响应信息 ''' url = url + "futureloan/mvc/api/member/login" r = baserequests.post(url, data=data) return r def getList(url, baserequests): url = url + "futureloan/mvc/api/member/list" r = baserequests.get(url) return r # 测试代码 if __name__ == '__main__': from ZongHe.caw.BaseRequests import BaseRequests baserquests = BaseRequests() canshu = {"mobilephone": 12323123, "pwd": 123} r = register("http://jy001:8081/", baserquests, canshu) print(r.json())
:param baserequests: 是BaseRequests的一个实例 :param data: 注册接口的参数 :return: 响应信息 ''' url = url + "futureloan/mvc/api/member/register" r = baserequests.post(url, data=data) return r # 获取用户列表 def getList(url, baserequests): url = url + "futureloan/mvc/api/member/list" r = baserequests.get(url) return r # 登录账号 def login(url, baserequests, data): url = url + "futureloan/mvc/api/member/login" r = baserequests.post(url, data=data) return r # 测试代码,用完删除 if __name__ == '__main__': from ZongHe.caw.BaseRequests import BaseRequests aaa = BaseRequests() canshu = {"mobilephone": 12323123, "pwd": 132} r = register("http://jy001:8081/", aaa, canshu) print(r.json())