def test_rewardranks(self): r = requests.get(self.url6, headers=con_login.common_header(self)) msg = r.json()['msg'] print('奖励详情') try: self.assertEqual(msg, 'success', 'fail') print('获取奖励详情成功') except: print('获取失败', r.json())
def test_expinfo(self): r = requests.get(self.url4, headers=con_login.common_header(self)) print('打卡及经验显示') try: self.assertEqual(r.json()['msg'], 'success', 'fail') print('查询成功') except: print('查询失败', r.json()) sleep(3)
def test_del_comment(self): pa = data.test_get_comment_first(self) params = { 'relation_id': data.test_get_comment_first(self), 'type': '1' } r = requests.post(self.url3, data=params, headers=con_login.common_header(self)) msg = r.json()['msg'] self.assertEqual(msg, '删除成功', 'failed')
def test_sign(self): r = requests.post(self.url5, headers=con_login.common_header(self)) print('签到:') try: tag = r.json()['data'] msg = r.json()['msg'] if tag == True: print('已经签到过了') if tag != True: print('签到成功') except: print('签到失败', r.json())
def test_get_comment_first(self): relationid = test_get_list(self) data = { 'content': '测试接口评论', 'parent_id': '', 'relation_id': relationid, 'replied_user_id': '', 'voice_content': '', 'type': '1' } r = requests.post('http://119.27.167.20:8083/comment.json', params=data, headers=con_login.common_header(self)) rel = r.json()['data']['_id'] return rel
def test_addinvitedcode(self): sheetName = 'Sheet1' # print(read.get_excel_data('/pyrequest/source/testinvitedcode.xlsx',sheetName)) list = [108811, None, 122342] value = random.sample(list, 1) params = {' invited_code': value} r = requests.post(self.url7, params=params, headers=con_login.common_header(self)) try: if r.json()['msg'] == '已经填写过邀请码了,不能重复填写': print('已经填写过邀请码了,不能重复填写,pass') if r.json()['code'] == 100020: print('邀请码不能为空,pass') if r.json()['msg'] == '邀请码错误啦!怎么肥四': print('邀请码错误,pass') if r.json()['code'] == 200: print('添加成功') except: print('invite系统异常', r.json())
def test_praise_comment(self): r = requests.get(self.url2, headers=con_login.common_header(self)) msg = r.json()['msg'] self.assertEqual(msg, '操作成功', 'FALSE')
def test_loginout(self): r = requests.get(self.url, headers=con_login.common_header(self)) msg = r.json()['msg'] self.assertEqual(msg, '退出成功', 'FALSE')
def test_expinfo(self): r = requests.get(self.url4, headers=con_login.common_header(self)) print('打卡及经验显示') self.assertEqual(r.json()['msg'], 'success', ('Fail', r.json()))
def test_rewardranks(self): r = requests.get(self.url6, headers=con_login.common_header(self)) msg = r.json()['msg'] print('奖励详情') self.assertEqual(msg, 'success', ('Fail', r.json()))