def test_reportReply(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] replyData = testData.getReplyData(createPostid, self.UserId) reply = self.post.postReplay(replyData) self.assertEquals(reply.json()['status'], '200', '回复失败') reportReply = self.post.reportReplayPost( testData.getReportReplyData(reply.json()['data']['reply_id'])) self.assertEquals(reportReply.json()['status'], '200', '举报回复失败')
def test_reportValid(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] reportResult = self.post.reportMainPost( testData.getReportMainData(createPostid)) logger.info("测试结果——————————————————————————:%s" % reportResult.text) self.assertEquals(reportResult.json()['status'], '200', '举报帖子返回非200')
def test_privateReply(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] replyData = testData.getReplyData(createPostid, self.UserId, is_private=1) replyResult = postAllAction.anotherReply(replyData, self.anotherMobile) self.assertEquals(replyResult.json()['status'], '200', '回复帖子失败') return createPostid
def test_duplicateReport(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] reportParam = testData.getReportMainData(createPostid) reportResult = self.post.reportMainPost(reportParam) logger.info("举报帖子测试结果——————————————————————————:%s" % reportResult.text) self.assertEquals(reportResult.json()['status'], '200', '举报帖子返回非200') reportResult1 = self.post.reportMainPost(reportParam) self.assertEquals(reportResult1.json()['status'], '202', '重复举报失败')
def test_anotherLike(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] post = HZAppAPI(self.anotherMobile) likeResult = post.cancelLike({ 'ids': [ createPostid, ], 'is_collect': 1 }) self.assertEquals(likeResult.json()['status'], '200', '他人收藏帖子失败') return likeResult
def test_reportDataVsDatabase(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] reportParam = testData.getReportMainData(createPostid) reportResult = self.post.reportMainPost(reportParam) logger.info("举报帖子测试结果——————————————————————————:%s" % reportResult.text) self.assertEquals(reportResult.json()['status'], '200', '举报帖子返回非200') checkResult = postAllAction.checkReportDatabase( reportParam['content'], self.mobile, createPostid) self.assertEquals(checkResult, True, '举报的内容无法在后台查询到')
def test_myReplyValid(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] replyData = testData.getReplyData(createPostid, self.UserId) replyResult = postAllAction.anotherReply(replyData, '13974030833') self.assertEquals(replyResult.json()['status'], '200', '回复失败') getReplyDetail = self.post.myReplaylist({ "time": 0, "limit": 100, "sort": -1 }) self.assertEquals(getReplyDetail.json()['status'], '200', '获取回复数据成功')
def test_replyParent(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] replyData = testData.getReplyData(createPostid, self.UserId) replyResult = postAllAction.anotherReply(replyData, self.anotherMobile) self.assertEquals(replyResult.json()['status'], '200', '回复帖子失败') getReply_id = replyResult.json()['data']['reply_id'] anotherUserid = GetTestData(self.anotherMobile).UserId anReplyData = testData.getReplyData(createPostid, anotherUserid, getReply_id) anotherReply = postAllAction.anotherReply(anReplyData, self.anotherMobile) self.assertEquals(anotherReply.json()['status'], '200', '回复回复的操作失败')
def test_likeAndViewList(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] likeFirLen = len(self.test_likeList().json()['data']) likeResult = self.post.cancelLike({ 'ids': [ createPostid, ], 'is_collect': 1 }) self.assertEquals(likeResult.json()['status'], '200', '帖子收藏失败') likeId = likeResult.json()['data']['like_ids'] likeSecLen = len(self.test_likeList().json()['data']) print likeFirLen, likeSecLen self.assertEquals(likeFirLen + 1, likeSecLen, '新增收藏数据,在列表显示失败') return [likeId, likeSecLen]
def test_reportReplyDataVsDatabase(self): postData = postAllAction.deleteAndCreatePost(self.mobile, 3) if postData: #创建完帖子 self.assertEquals(postData[0].json()['status'], '200', '创建帖子失败') createPostid = postData[0].json()['data']['post_id'] #获取回复数据 replyData = testData.getReplyData(createPostid, self.UserId) #回复帖子 reply = self.post.postReplay(replyData) self.assertEquals(reply.json()['status'], '200', '回复失败') replyId = reply.json()['data']['reply_id'] #获取举报帖子参数 reportReplyData = testData.getReportReplyData(replyId) #举报帖子 reportReply = self.post.reportReplayPost(reportReplyData) self.assertEquals(reportReply.json()['status'], '200', '举报回复失败') #检查举报的内容能否在数据库中查询得到 checkResult = postAllAction.checkReportDatabase( reportReplyData['content'], self.mobile, replyId) self.assertEquals(checkResult, True, '举报回复的内容无法在后台查询到')