def test_realname(token): headers = {'token': token, 'charset': 'UTF-8'} url = 'http://qa.yansl.com:8084/cst/realname2' email = random_tool.random_email() sex = random_tool.random_sex() # 随机生成男(1)或女(0) cst_name = random_tool.random_name(sex) area = random_tool.random_area() area_id = area['code'] area_name = area['name'] province = area['province'] city = area['city'] birth_days = random_tool.random_birthday(18, 35) cert_no = identity_tool.generate_id(sex=sex, area_id=area_id, birth_days=birth_days) req = { "cstId": 15790, "customerInfo": { "birthday": '2020-10-31', "certno": cert_no, "city": city, "cstName": cst_name, "email": email, "province": province, "sex": sex } } print(req) resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() message = resp_json['message'] assert message == "认证成功"
def test_queryFans(token): url = "https://api.hnyoujin.cn/api/sns/attention/queryFans" headers = {"token": token, "Content-Type": "application/json"} req = {"page": "0", "size": "20"} resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() success = resp_json["success"] assert success == True
def test_oldlogin(): url = 'http://qa.yansl.com:8084/login' req = {"pwd": "123456zjcq", "userName": "******"} resp = request_tool.post_json(url, json=req) resp_json = resp.json() code = resp_json['code'] print(code) message = resp_json['message'] assert message == '登录失败,密码错误'
def test_login(name, pwd, assertion): url = 'http://qa.yansl.com:8084/login' req = {"pwd": pwd, "userName": name} resp = request_tool.post_json(url, json=req) print(resp) resp_json = resp.json() code = resp_json['code'] print(code) data = resp_json['data'] assert code == assertion
def test_changedlogin(): url = 'qa.yansl.com:8084/login' req = {"pwd": "123456zjc", "userName": "******"} resp = request_tool.post_json(url, json=req) print(resp) resp_json = resp.json() code = resp_json['code'] print(code) #message = resp_json['message'] #assert message =='登录成功' assert_tool.assert_equal(resp.status_code, 200)
def test_TeamList(token): url = "https://api.hnyoujin.cn/api/im/team/queryTeamList" headers = { "token": token, "Content-Type": "application/json" } resp = request_tool.post_json(url=url, headers=headers) resp_json = resp.json() success = resp_json["success"] assert success == True
def test_balance(token): url = 'https://api.hnyoujin.cn/api/platform/userInfo/viewAccount' headers = { 'token': token, "Content-Type": "application/json" } req = { "content": "balance" } resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() # 提取响应内容进行断言;验证是否修改成功; success = resp_json['success'] assert success == True
def test_search(token): url = "https://api.hnyoujin.cn/api/sns/attention/findUserByAccountOrPhone0" headers = { "Content-Type": "application/json", "token": token } req = { "id": "17396240733" } resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() success = resp_json['success'] assert success == True
def test_balance(token): url = 'https://api.hnyoujin.cn/api/sns/circle/queryNearby' headers = {'token': token, "Content-Type": "application/json"} req = { "page": 0, "size": 20, "latitude": 30.57664852016058, "longitude": 104.0654955195855, "regionNo": "028" } resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() # 提取响应内容进行断言;验证是否修改成功; success = resp_json['success'] assert success == True
def test_changepwd(token): url = 'qa.yansl.com:8084/user/changepwd' headers = {'token': token, 'charset': 'UTF-8'} req = { "newPwd": "123456zjc", "oldPwd": "123456zjcq", "reNewPwd": "123456zjc", "userName": "******" } resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() # 提取响应内容进行断言;验证是否修改成功; #message = resp_json['message'] #assert message == "修改成功1" allure.attach("预期结果:{},实际结果:{}".format(200, resp.status_code), "响应状态码", allure.attachment_type.TEXT) assert_tool.assert_equal(resp.status_code, 200)
def test_sign(): url = 'http://qa.yansl.com:8084/signup' phone = random_tool.random_tell() pwd = random_tool.random_pwd() re_pwd = pwd user_name = random_tool.random_name_pinyin() num = random_tool.random_number(10, 99) req = { "phone": phone, "pwd": pwd, "rePwd": re_pwd, "userName": user_name + str(num) } resp = request_tool.post_json(url, json=req) resp_json = resp.json() code = resp_json['code'] assert code == 2000
def test_sign(): url = 'qa.yansl.com:8084/signup' phone = random_tool.random_tell() pwd = random_tool.random_pwd() re_pwd = pwd user_name = random_tool.random_name_pinyin() num = random_tool.random_number(10, 99) req = { "phone": phone, "pwd": pwd, "rePwd": re_pwd, "userName": user_name + str(num) } resp = request_tool.post_json(url, json=req) resp_json = resp.json() code = resp_json['code'] assert code == 2000 # logger('注册shibai').error('自知则知之') logger("注册").info("账号或者密码错误")
def test_login_yzm(): url = 'https://api.hnyoujin.cn/api/pass/login/v1/loginMobileCodeVerification' headers = {"Content-Type": "application/json"} req = { "account": "17396240733", "code": "964921", "deviceModel": "ELE-AL00", "mac": "02:00:00:00:00:02", "imei": "865166020414713", "center": "104.06549581016573,30.576648460590466", "softwareVersion": "5.1.1", "machineVersion": "Other", "netType": "WIFI", "cityCode": "028", "appVersion": "1.0.1", "deviceId": "20200903185703dabf12e1be271324194be12019f51f4301a4ddb69bd33ae9", "deviceTypeSkyEnum": "android" } resp = request_tool.post_json(url=url, headers=headers, json=req) resp_json = resp.json() # 提取响应内容进行断言;验证是否修改成功; success = resp_json['success'] assert success == True