class Shop(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------管理我的店铺 - 店铺详情内容---------------------------------- def testcase_001(self): sheet_index = 12 row = 29 member_id = '10394' print("testcase_001管理我的店铺 - 店铺详情内容:") payload = {"shop_id": "29388"} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Follow_tips(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------获取粉丝人数---------------------------------- def testcase_001(self): sheet_index = 2 row = 12 print("testcase_001获取粉丝人数:") member_id = "745" payload = {"target_role": 10394} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class Sync_iconshow(unittest.TestCase): def setUp(self): self.r = FuncRequests() self.member_id ='none' def testcase_001(self): sheet_index = 6 row = 11 print("testcase_001发布时第三方平台图标显示") payload = {} result=self.r.interface_requests_payload(self.member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class CommentsPublish(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------用户关注的 Q/A 列表---------------------------------- def testcase_001(self): sheet_index = 1 row = 89 print("testcase_001 用户关注的 Q/A 列表:") member_id = "744" payload = {"page": 1,"type": "qa","member_id":member_id} result=self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class MemberInfo(unittest.TestCase): def setUp(self): self.member_id = '744' self.requests = FuncRequests() #-----------------查看存在的当前用户信息,is_verify邮箱是否已经验证 1:是 0:否---------------------------------- def testcase_001(self): sheet_index = 0 row = 34 print("testcase001查看当前用户信息:") payload = {"member_id": 744} result = self.requests.interface_requests_payload( self.member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") self.assertEqual('', result['msg']) print("msg返回值:ok")
class System_nation(unittest.TestCase): def setUp(self): self.r = FuncRequests() # -----------------news--标签---------------------------------- def testcase_001(self): sheet_index = 3 row = 22 print("testcase_001 news标签:") self.member_id = "745" payload = {"type": "hotnews"} result = self.r.interface_requests_payload(self.member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class Ads(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------广告数据统计---------------------------------- def testcase_001(self): sheet_index = 10 row = 5 member_id = 'none' print("testcase_001 广告数据统计:") obj = ({"ad_id": 123, "view_num": 2, "click_num": 3}, ) data = json.dumps(obj) payload = {"data": data} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Shop(unittest.TestCase): def setUp(self): self.r=FuncRequests() #-----------------店铺线索新增成功---------------------------------- def testcase_001(self): sheet_index = 12 row = 8 print ("testcase_001店铺线索新增成功:") obj = ({"week":[1,2],"start":"01:00","close":"03:00"},{"week":[4,5],"start":"05:00","close":"06:00"}) business_hours = json.dumps(obj) payload = {"cover": "posts/153682373426094_960_ios.jpg", "address": "kangjian", "shop_name":"shop_lisa","business_hours":business_hours,"nation":"china","city":"shanghai","payment":"zhifubao","tel":"18833255555"} member_id = "744" result=self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class CommentsPublish(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------发表Q/A的回答---------------------------------- def testcase_001(self): sheet_index = 1 row = 71 print("testcase_001 发表Q/A的回答:") # 调用发布接口发送一条动态,获取question_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # payload1 = { "content": "接口在" + date + "测试发布Q/A","category":"qa"} # member_id1 = "748" # urlpart = '/posts/publish' # result1 = self.r.interface_requests_data(member_id1, urlpart, payload1) # print(result1) # global question_id # question_id = result1["data"]["question_id"] # print(question_id) obj = ({ "androidid": "1532313356301", "imageUrl": "https://s3-us-west-2.amazonaws.com/images-omv/posts/1532313355871_767_android.jpg", "radio": "1.0000", "tag": 1 }) aztec_images = json.dumps(obj) payload = {"question_id": "19183", "content": "接口在" + date + "测试回答Q/A"} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) answer_id = result["data"]["answer_id"] print("answer_id=", answer_id) self.assertEqual(10000, result["code"]) print("code返回值:10000") #回答成功后,删除回答,不然后面的接口不能再回答这个问题 payload1 = {"answer_id": answer_id} member_id1 = "744" urlpart = '/answer/delete' result1 = self.r.interface_requests_data(member_id1, urlpart, payload1)
class Sign(unittest.TestCase): def setUp(self): self.requests = FuncRequests() self.member_id = '959' #-----------------签到 - 用户补签提示---------------------------------- #1 已经签到 2 ,漏签, 3,当天未签到 4 未来未签到 def testcase_001(self): #-----用户注册----- self.member_id = '959' sheet_index = 0 row = 138 print("testcase_001签到 用户补签提示:") payload = {'date': '2019-01-01', 'sign_status': '1'} result = self.requests.interface_requests_payload( self.member_id, sheet_index, row, payload) # result = self.requests.interface_requests(self.member_id,sheet_index,row) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Brands(unittest.TestCase): def setUp(self): self.r = FuncRequests() self.member_id = '745' #-----------------获取商业级用户的登录信息---------------------------------- def testcase_001(self): sheet_index = 0 row = 109 print("testcase_001获取商业级用户的登录信息:") payload = { "normal_member_id": 745, "target_role": 10394, "fcm_token": "fcm_token" } result = self.r.interface_requests_payload(self.member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Brands(unittest.TestCase): def setUp(self): self.r=FuncRequests() #-----------------修改品牌logo---------------------------------- # "avatar/1534491048212_1645_android.jpg" # "avatar/1534820178727_980_android.jpg" def testcase_001(self): sheet_index = 11 row = 6 member_id='34791' print ("testcase_001修改品牌logo:") payload = {"brand_id": 1, "logo_url": "avatar/1534491048212_1645_android.jpg"} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class CommentsPublish(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------回答的删除---------------------------------- def testcase_001(self): sheet_index = 1 row = 77 print("testcase_001 回答的删除:") # 调用发布接口发送一条动态,获取question_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # payload1 = { "content": "接口在" + date + "测试发布Q/A","category":"qa"} # member_id1 = "748" # urlpart1 = '/posts/publish' # result1 = self.r.interface_requests_data(member_id1, urlpart1, payload1) # global question_id # question_id = result1["data"]["question_id"] # print(question_id) # 调用QA回答接口发送一条回答,获取answer_id payload2 = {"question_id": 19183, "content": "接口在" + date + "测试回答Q/A"} member_id2 = "744" urlpart2 = '/answer/publish' result2 = self.r.interface_requests_data(member_id2, urlpart2, payload2) global answer_id answer_id = result2["data"]["answer_id"] print(answer_id) payload = {"answer_id": answer_id} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") # 回答成功后,删除回答,不然后面的接口不能再回答这个问题 payload1 = {"answer_id": answer_id} member_id1 = "744" urlpart = '/answer/delete' result1 = self.r.interface_requests_data(member_id1, urlpart, payload1)
class Brands(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------话题发布---------------------------------- def testcase_001(self): sheet_index = 11 row = 1 member_id = '744' print("testcase_001话题发布:") date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload = { "brand_id": 1, "title": "接口在" + date + "测试发布话题", "topic_content": date + "话题内容" } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Brands(unittest.TestCase): def setUp(self): self.r = FuncRequests() self.member_id = '34790' #-----------------解绑管理员角色---------------------------------- def testcase_001(self): sheet_index = 0 row = 127 print("testcase_001解绑管理员角色:") payload = { "normal_member_id": 745, "member_id": 34790, "type": "shop", "business_id": 53951 } result = self.r.interface_requests_payload(self.member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Message(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------QA消息列表第一页数据---------------------------------- def testcase_001(self): sheet_index = 5 row = 3 print("testcase_001QA消息列表第一页数据:") member_id1 = "748" result = self.r.interface_requests(member_id1, sheet_index, row) message_list = result['data']['list'] global question_id, comment_id, member_id, category question_id = message_list[9]['question_id'] comment_id = message_list[9]['comment_id'] member_id = message_list[9]['member_id'] category = message_list[9]['category'] print(question_id, comment_id, member_id, category) self.assertEqual(10000, result["code"]) print("code返回值:10000") #-----------------QA消息列表第二页数据---------------------------------- def testcase_002(self): sheet_index = 5 row = 4 print("testcase_002 QA消息列表第二页数据:") member_id1 = "748" payload = { "page": 2, "question_id": question_id, "comment_id": comment_id, "member_id": member_id, "category": category } result = self.r.interface_requests_payload(member_id1, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class RewardsDescription(unittest.TestCase): def setUp(self): self.member_id = '744' self.requests = FuncRequests() #-----------------兑换商品详情---------------------------- def testcase_001(self): sheet_index = 8 row = 10 # 先调用积分接口获取goods_id,然后根据goods_id得到商品详情 urlpart = '/membership' payload = {} result1 = self.requests.interface_requests_data( self.member_id, urlpart, payload) goods_id = result1['data']['gifts'][0]['goods_id'] print("testcase001 兑换商品详情:") payload = {'goods_id': goods_id} result = self.requests.interface_requests_payload( self.member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Brands(unittest.TestCase): def setUp(self): self.r=FuncRequests() #-----------------删除收货地址---------------------------------- def testcase_001(self): sheet_index = 0 row = 103 print("testcase_001删除收货地址:") # 先调用添加收获地址借口哦添加一个地址,然后进行删除 date = int(time.time()) payload = {'firstname': 'Yu' ,'lastname':date ,'phone':'15800110123','country':'China','state':'shanghai','city':'shanghai','street':'No.1611,zhennan road','zip_code':'210110'} member_id = "744" urlpart = '/member/address/add' result1 = self.r.interface_requests_data(member_id, urlpart, payload) address_id = result1['data']['address_id'] payload = {'address_id':address_id} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Shop(unittest.TestCase): def setUp(self): self.r=FuncRequests() #-----------------管理我的店铺 - 店铺主页修改---------------------------------- def testcase_001(self): sheet_index = 12 row = 28 member_id='10394' print ("testcase_001管理我的店铺 - 店铺主页修改:") date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) obj=[{"week":["1","2","3","4","5","6","7"],"start":"09:00","close":"18:00"},] business_hours=json.dumps(obj) payload = {"name": "IECIE Shanghai Vape Culture Week", "info": "info","cover":"posts/1512710644871_767_android.jpg","business_hours":business_hours, "tel":"15800328065","nation":"China","city":"shanghai","address":"qilianshanlu","payment":"zhifubao", "ins":"www.ins.com","youtube":"www.youtube.com","twitter":"www.twitter.com","website":"www.baidu.com", "facebook":"www.fb1.com","shop_id":"29388","timezone":8,"normal_member_id":745,"is_delivery":1} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Praise(unittest.TestCase): def setUp(self): self.r = FuncRequests() # 获取版本 self.version = Version().test_version() self.url = Url().test_url() #-----------------动态点赞/取消点赞---------------------------------- def testcase_001(self): sheet_index = 1 row = 8 print("testcase_001动态点赞/取消点赞:") # 调用发布接口发送一条动态,获取post_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = {"uid": "744", "content": "接口在" + date + "测试发布纯文字"} member_id1 = "748" urlpart = '/posts/publish' result1 = self.r.interface_requests_data(member_id1, urlpart, payload1) post_id = result1["data"]["post_id"] payload = {"post_id": post_id, "praise_state": 1} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") #-----------------点赞/取消点赞不存在的post id---------------------------------- def testcase_002(self): sheet_index = 1 row = 10 print("testcase_002点赞/取消点赞不存在的post id:") member_id = "744" result = self.r.interface_requests(member_id, sheet_index, row) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class Shop(unittest.TestCase): def setUp(self): self.requests = FuncRequests () self.member_id = 'none' #-----------------举报商户成功---------------------------------- def testcase_001(self): #先注册新用户 sheet_index =0 row = 12 print("testcase001 用户注册成功:") nowTime = time.strftime ( "%Y%m%d_%H_%M_%S" ) nickname = 'heyu'+nowTime email = 'heyu'+nowTime+'@qq.com' print(email) payload = {'email': email,'password': '******','displayname': 'heyu','nickname': nickname,'equipment_number': 'PE-TL10',} result = self.requests.interface_requests_payload(self.member_id,sheet_index,row,payload) self.member_id=str(result["data"]["member_id"]) print(self.member_id) sheet_index = 12 row = 2 print ("testcase_001举报商户:") result = self.requests.interface_requests(self.member_id,sheet_index,row) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------重复举报商户---------------------------------- def testcase_002(self): sheet_index = 12 row = 3 self.member_id = "744" print ("testcase_002重复举报商户:") result = self.requests.interface_requests(self.member_id,sheet_index,row) self.assertEqual(10014, result['code']) print("code返回值:10014") print("msg:You are reported.")
class CommentsPublish(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------news详情(review类型)---------------------------------- def testcase_001(self): sheet_index = 1 row = 96 print("testcase_001 news详情(review类型):") # 调用发布接口发送一条动态,获取post_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = { "content": "接口在" + date + "测试发布review", "category": "review", "review_title": "review_title", "review_product": "review_product", "review_type": "review_type" } member_id1 = "744" urlpart1 = '/posts/publish' result1 = self.r.interface_requests_data(member_id1, urlpart1, payload1) print(result1) global post_id post_id = result1["data"]["post_id"] print(post_id) payload = {"category": "review", "post_id": post_id} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") # -----------------news详情(news类型)---------------------------------- def testcase_002(self): sheet_index = 1 row = 97 print("testcase_002 news详情(news类型):") payload = {"category": "news", "post_id": "41931"} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") # -----------------hotnews详情(news类型)---------------------------------- def testcase_003(self): sheet_index = 1 row = 110 print("testcase_003news详情(hotnews类型):") payload = {"category": "news", "post_id": "41931"} member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class Shop(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------管理我的店铺 - 图片上传---------------------------------- def testcase_001(self): sheet_index = 12 row = 23 member_id = '10394' print("testcase_001管理我的店铺 - 图片上传:") obj = ({ "path": "posts/1512710644871_767_android.jpg", "ratio": 1.23, "tag": 1 }, ) images = json.dumps(obj) payload = { "shop_id": "29388", "images": images, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------管理我的店铺 - 视频上传---------------------------------- def testcase_002(self): sheet_index = 12 row = 24 member_id = '10394' print("testcase_002管理我的店铺 - 视频上传:") payload = { "shop_id": "29388", "video": "posts/1505153294565_832_android.mp4", "video_cover": 'posts/1505153294565_832_android.jpg', "video_cover_ratio": 1.00, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------管理我的店铺 - 其他管理员图片上传---------------------------------- def testcase_003(self): sheet_index = 12 row = 45 member_id = '34791' print("testcase_003管理我的店铺 - 其他管理员图片上传:") obj = ({ "path": "posts/1512710644871_767_android.jpg", "ratio": 1.23, "tag": 1 }, ) images = json.dumps(obj) payload = { "shop_id": "29388", "images": images, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Shop(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------产品 - 删除一个产品---------------------------------- def testcase_001(self): sheet_index = 12 row = 34 member_id = '10394' print("testcase_001删除一个产品:") # 调用新增产品接口发送一条动态,获取product_ids product_ids = product() payload = { "shop_id": 29388, "product_ids": product_ids, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------产品 - 删除多个产品---------------------------------- def testcase_002(self): sheet_index = 12 row = 35 member_id = '10394' print("testcase_001删除一个产品:") # 调用新增产品接口发送一条动态,获取product_ids product_id1 = product() product_id2 = product() product_id3 = product() product_ids = str(product_id1) + ',' + str(product_id2) + ',' + str( product_id3) print("product_ids=", product_ids) payload = { "shop_id": 29388, "product_ids": product_ids, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------产品 - 删除一个产品---------------------------------- def testcase_003(self): sheet_index = 12 row = 44 member_id = '34791' print("testcase_003其他管理员删除一个产品:") # 调用新增产品接口发送一条动态,获取product_ids product_ids = product() payload = { "shop_id": 29388, "product_ids": product_ids, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class CommentsPublish(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------用户对于Q/A的回答列表第一页数据---------------------------------- def testcase_001(self): sheet_index = 1 row = 82 print("testcase_001 用户对于Q/A的回答列表第一页数据:") # 调用发布接口发送一条动态,获取post_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = { "content": "接口在" + date + "测试发布Q/A","category":"qa"} member_id1 = "748" urlpart = '/posts/publish' result1 = self.r.interface_requests_data(member_id1, urlpart, payload1) print(result1) global question_id question_id = result1["data"]["question_id"] print(question_id) # 调用QA回答接口发送一条回答 payload2 = {"question_id": question_id, "content": "接口在" + date + "测试回答Q/A"} member_id2 = "744" urlpart2 = '/answer/publish' result2 = self.r.interface_requests_data(member_id2, urlpart2, payload2) result2 = self.r.interface_requests_data('745', urlpart2, payload2) result2 = self.r.interface_requests_data('746', urlpart2, payload2) result2 = self.r.interface_requests_data('747', urlpart2, payload2) result2 = self.r.interface_requests_data('748', urlpart2, payload2) result2 = self.r.interface_requests_data('749', urlpart2, payload2) result2 = self.r.interface_requests_data('750', urlpart2, payload2) result2 = self.r.interface_requests_data('751', urlpart2, payload2) result2 = self.r.interface_requests_data('752', urlpart2, payload2) result2 = self.r.interface_requests_data('753', urlpart2, payload2) result2 = self.r.interface_requests_data('754', urlpart2, payload2) payload = {"question_id": question_id,"page": 1} member_id="744" result=self.r.interface_requests_payload(member_id, sheet_index, row, payload) global last_answer_id last_answer_id=result["data"]["last_answer_id"] print(last_answer_id) self.assertEqual(10000, result["code"]) print("code返回值:10000") # -----------------用户对于Q/A的回答列表第二页数据----------------------------------- def testcase_002(self): sheet_index = 1 row = 83 print("testcase_002 用户对于Q/A的回答列表二页数据:") member_id = "744" payload={"question_id":question_id,"page":2,"last_answer_id":last_answer_id} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") # -----------------用户744的Q/A回答列表---------------------------------- def testcase_003(self): sheet_index = 1 row = 84 print("testcase_002 用户744的Q/A回答列表:") member_id = "744" payload={"question_id":question_id,"page":1,"member_id":member_id} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000")
class PostsRepeat(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------转发---------------------------------- def testcase_001(self): sheet_index = 1 row = 19 print("testcase_001转发:") # 1.调用发布接口发送一条动态,获取post_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = {"uid": "744", "content": "接口在" + date + "测试发布纯文字"} member_id = "744" urlpart1 = '/posts/publish' result1 = self.r.interface_requests_data(member_id, urlpart1, payload1) print(result1) global post_id post_id = result1["data"]["post_id"] payload = { "uid": "744", "post_id": post_id, "content": "接口在" + date + "转发测试" } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") # -----------------转发时content为空---------------------------------- def testcase_002(self): sheet_index = 1 row = 41 print("testcase_002转发时content为空:") payload = {"uid": "744", "post_id": post_id} # 获取token值 member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result["code"]) print("code返回值:10000") #-----------------转发postid不存在---------------------------------- def testcase_003(self): sheet_index = 1 row = 42 print("testcase_003转发post_id不存在:") date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload = { "uid": "744", "post_id": "99999999", "content": "接口在" + date + "转发测试" } # 获取token值 member_id = "744" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10003, result["code"]) print("code返回值:10003") #-----------------转发uid不存在---------------------------------- def testcase_004(self): sheet_index = 1 row = 43 print("testcase_004转发uid不存在:") date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload = {"post_id": post_id, "content": "接口在" + date + "转发测试"} # 获取token值 member_id = "9999999" result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10040, result["code"]) print("code返回值:10040")
class Shop(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------产品 - 修改产品---------------------------------- def testcase_001(self): sheet_index = 12 row = 36 member_id = '10394' print("testcase_001修改产品:") # 调用新增产品接口发送一条动态,获取product_ids obj = ({ "path": "posts/1512710644871_767_android.jpg", "ratio": 1.23, "tag": 1 }, ) images = json.dumps(obj) date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = { "name": "autotest" + date, "description": "description" + date, "images": images, "shop_id": 29388, "normal_member_id": 745 } # 获取发布接口token值 urlpart1 = '/product/add' result1 = self.r.interface_requests_data(member_id, urlpart1, payload1) product_id = result1["data"]["product_id"] print("product_id=", product_id) payload = { "name": "修改autotest" + date, "description": "修改description" + date, "product_id": product_id, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------产品 - 其他管理员修改产品---------------------------------- def testcase_002(self): sheet_index = 12 row = 36 member_id = '34791' print("testcase_002其他管理员修改产品:") # 调用新增产品接口发送一条动态,获取product_ids obj = ({ "path": "posts/1512710644871_767_android.jpg", "ratio": 1.23, "tag": 1 }, ) images = json.dumps(obj) date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) payload1 = { "name": "autotest" + date, "description": "description" + date, "images": images, "shop_id": 29388, "normal_member_id": 745 } # 获取发布接口token值 urlpart1 = '/product/add' result1 = self.r.interface_requests_data(member_id, urlpart1, payload1) product_id = result1["data"]["product_id"] print("product_id=", product_id) payload = { "name": "修改autotest" + date, "description": "修改description" + date, "product_id": product_id, "normal_member_id": 745 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")
class Brands(unittest.TestCase): def setUp(self): self.r = FuncRequests() #-----------------品牌下的最新想法列表第1页数据---------------------------------- def testcase_001(self): sheet_index = 11 row = 22 print("testcase_001品牌下的最新想法列表第1页数据:") member_id = '980' payload = {"page": 1, "brand_id": 1, "topic_id": 0} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) list = result["data"]["list"] global last_id last_id = list[9]["post_id"] print("last_id=", last_id) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------品牌下的最新想法列表第2页数据---------------------------------- def testcase_002(self): sheet_index = 11 row = 23 print("testcase_002品牌下的最新想法列表第2页数据:") member_id = '980' payload = {"page": 2, "last_id": last_id, "brand_id": 1, "topic_id": 0} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------话题下的最新想法列表第1页数据---------------------------------- def testcase_003(self): sheet_index = 11 row = 24 print("testcase_003话题下的最新想法列表第1页数据:") member_id = '980' payload = {"page": 1, "brand_id": 0, "topic_id": 40} result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) list = result["data"]["list"] global last_id1 last_id1 = list[9]["post_id"] print("last_id=", last_id1) self.assertEqual(10000, result['code']) print("code返回值:10000") #-----------------话题下的最新想法列表第2页数据---------------------------------- def testcase_004(self): sheet_index = 11 row = 25 print("testcase_004话题下的最新想法列表第2页数据:") member_id = '980' payload = { "page": 2, "last_id": last_id1, "brand_id": 0, "topic_id": 40 } result = self.r.interface_requests_payload(member_id, sheet_index, row, payload) self.assertEqual(10000, result['code']) print("code返回值:10000")