Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
backend_auto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邓莹莹
backend_auto
Commits
9d990c2e
Commit
9d990c2e
authored
Jun 18, 2021
by
林颖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整合部分代码--新增帖子&问答部分
parent
2e45e176
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
463 additions
and
43 deletions
+463
-43
hybrid_request.py
all_backend_api/hybrid_request.py
+12
-0
hybrid_request.yaml
all_backend_api/hybrid_request.yaml
+23
-0
qa_request.py
all_backend_api/qa_request.py
+20
-0
qa_request.yaml
all_backend_api/qa_request.yaml
+22
-0
topicreply_vote.yaml
all_backend_api/topicreply_vote.yaml
+1
-1
topicreply_vote_request.py
all_backend_api/topicreply_vote_request.py
+2
-2
tractate_request.py
all_backend_api/tractate_request.py
+23
-2
tractate_request.yaml
all_backend_api/tractate_request.yaml
+40
-4
path_setting.py
path_setting.py
+29
-11
test_reply.py
test_backend_case/common_case/test_reply.py
+1
-19
test_question_new_answer_list.py
...backend_case/hybrid_case/test_question_new_answer_list.py
+48
-0
test_question_v1.py
test_backend_case/hybrid_case/test_question_v1.py
+39
-0
__init__.py
test_backend_case/qa_case/__init__.py
+0
-0
test_favor.py
test_backend_case/qa_case/test_favor.py
+30
-0
test_vote.py
test_backend_case/topic_case/test_vote.py
+2
-2
test_publish_reply.py
test_backend_case/tractate_case/test_publish_reply.py
+36
-0
test_vote.py
test_backend_case/tractate_case/test_vote.py
+40
-0
reply.yaml
test_backend_data/common_data/reply.yaml
+1
-1
question_new_answer_list.yaml
test_backend_data/hybrid_data/question_new_answer_list.yaml
+18
-0
question_v1.yaml
test_backend_data/hybrid_data/question_v1.yaml
+8
-0
personal_recommends.yaml
test_backend_data/personal_data/personal_recommends.yaml
+1
-1
__init__.py
test_backend_data/qa_data/__init__.py
+0
-0
favor.yaml
test_backend_data/qa_data/favor.yaml
+16
-0
publish_reply.yaml
test_backend_data/tractate_data/publish_reply.yaml
+27
-0
vote.yaml
test_backend_data/tractate_data/vote.yaml
+24
-0
No files found.
all_backend_api/hybrid_request.py
View file @
9d990c2e
...
...
@@ -41,6 +41,18 @@ class hybrid_request(BaseRequest):
return
self
.
api_send
(
self
.
data
[
'brand'
])
# 问答详情页问题详情
def
question_v1
(
self
):
return
self
.
api_send
(
self
.
data
[
'question_v1'
])
# 问答详情页--回答列表
def
question_new_answer_list
(
self
,
question_id
):
self
.
params
[
'question_id'
]
=
question_id
return
self
.
api_send
(
self
.
data
[
'question_new_answer_list'
])
if
__name__
==
'__main__'
:
# print(self.data)
...
...
all_backend_api/hybrid_request.yaml
View file @
9d990c2e
...
...
@@ -38,3 +38,26 @@ brand:
data
:
{}
json
:
{}
#问答详情页--问题详情
question_v1
:
method
:
GET
url
:
/hybrid/question_v1/210502
params
:
data
:
{}
json
:
{}
isLogin
:
1
#问答详情页--回答列表
question_new_answer_list
:
method
:
GET
url
:
/hybrid/question/new_answer_list/_data
params
:
question_id
:
${question_id}
data
:
{}
json
:
{}
isLogin
:
1
all_backend_api/qa_request.py
0 → 100644
View file @
9d990c2e
import
path_setting
from
in_common.base_request
import
BaseRequest
class
qa_request
(
BaseRequest
):
def
__init__
(
self
):
self
.
data
=
self
.
api_load
(
path_setting
.
QA_CONFIG
)
# print(self.replyanswer)
# 帖子收藏
def
favor
(
self
,
answer_id
):
self
.
params
[
"answer_id"
]
=
answer_id
return
self
.
api_send
(
self
.
data
[
"favor"
])
# 帖子取消收藏
def
cancelfavor
(
self
,
answer_id
):
self
.
params
[
"answer_id"
]
=
answer_id
return
self
.
api_send
(
self
.
data
[
"cancelfavor"
])
all_backend_api/qa_request.yaml
0 → 100644
View file @
9d990c2e
#问题收藏
favor
:
method
:
post
url
:
/api/qa/favor
params
:
data
:
answer_id
:
${answer_id}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#问题取消收藏
cancelfavor
:
method
:
post
url
:
/api/qa/favor/cancel
params
:
data
:
answer_id
:
${answer_id}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
all_backend_api/topicreply_vote.yaml
View file @
9d990c2e
...
...
@@ -8,7 +8,7 @@ topic_reply_vote:
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
topic_reply_canc
le
vote
:
topic_reply_canc
el
vote
:
method
:
post
url
:
/hybrid/api/topicreply/cancel_vote/_data
params
:
...
...
all_backend_api/topicreply_vote_request.py
View file @
9d990c2e
...
...
@@ -10,9 +10,9 @@ class topicreply_vote_request(BaseRequest):
self
.
params
[
"id"
]
=
id
return
self
.
api_send
(
self
.
data
[
"topic_reply_vote"
])
def
topic_reply_canc
le
vote
(
self
,
id
):
def
topic_reply_canc
el
vote
(
self
,
id
):
self
.
params
[
"id"
]
=
id
return
self
.
api_send
(
self
.
data
[
"topic_reply_canc
le
vote"
])
return
self
.
api_send
(
self
.
data
[
"topic_reply_canc
el
vote"
])
# 进入日记贴详情页-用来判断这篇日记贴点赞过没
# def diary_detail(self, topic_id):
...
...
all_backend_api/tractate_request.py
View file @
9d990c2e
...
...
@@ -27,19 +27,40 @@ class tractate_request(BaseRequest):
self
.
params
[
"data_type"
]
=
data_type
return
self
.
api_send
(
self
.
data
[
"reply"
])
# 帖子
点赞
# 帖子
收藏
def
favor
(
self
,
tractate_id
,
data_type
):
self
.
params
[
"tractate_id"
]
=
tractate_id
self
.
params
[
"data_type"
]
=
data_type
return
self
.
api_send
(
self
.
data
[
"favor"
])
# 帖子取消
点赞
# 帖子取消
收藏
def
cancelfavor
(
self
,
tractate_id
,
data_type
):
self
.
params
[
"tractate_id"
]
=
tractate_id
self
.
params
[
"data_type"
]
=
data_type
return
self
.
api_send
(
self
.
data
[
"cancelfavor"
])
# 帖子点赞
def
tractate_vote
(
self
,
tractate_id
,
data_type
,
reply_id
):
self
.
params
[
"tractate_id"
]
=
tractate_id
self
.
params
[
"data_type"
]
=
data_type
self
.
params
[
"reply_id"
]
=
reply_id
return
self
.
api_send
(
self
.
data
[
"tractate_vote"
])
# 帖子取消点赞
def
tractate_cancelvote
(
self
,
tractate_id
,
data_type
,
reply_id
):
self
.
params
[
"tractate_id"
]
=
tractate_id
self
.
params
[
"data_type"
]
=
data_type
self
.
params
[
"reply_id"
]
=
reply_id
return
self
.
api_send
(
self
.
data
[
"tractate_cancelvote"
])
# 帖子创建一级&二级评论
def
publish_reply
(
self
,
tractate_id
,
data_type
,
reply_id
,
content
):
self
.
params
[
"tractate_id"
]
=
tractate_id
self
.
params
[
"data_type"
]
=
data_type
self
.
params
[
"reply_id"
]
=
reply_id
self
.
params
[
"content"
]
=
content
return
self
.
api_send
(
self
.
data
[
"publish_reply"
])
all_backend_api/tractate_request.yaml
View file @
9d990c2e
...
...
@@ -38,10 +38,6 @@ reply:
isLogin
:
0
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#帖子收藏
favor
:
method
:
post
...
...
@@ -66,3 +62,42 @@ cancelfavor:
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#帖子点赞
tractate_vote
:
method
:
post
url
:
/api/tractate/vote
params
:
data
:
tractate_id
:
${tractate_id}
data_type
:
${data_type}
reply_id
:
${reply_id}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#帖子取消点赞
tractate_cancelvote
:
method
:
post
url
:
/api/tractate/vote/cancel
params
:
data
:
tractate_id
:
${tractate_id}
data_type
:
${data_type}
reply_id
:
${reply_id}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#
#帖子创建一级评论
publish_reply
:
method
:
post
url
:
/api/tractate/publish_reply
params
:
data
:
tractate_id
:
${tractate_id}
data_type
:
${data_type}
reply_id
:
${reply_id}
content
:
${content}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
#
\ No newline at end of file
path_setting.py
View file @
9d990c2e
...
...
@@ -17,27 +17,25 @@ DIARY_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/diary_data",
#日记本关联美购
DIARY_SERVICE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"diary_service.yaml"
)
DIARY_SERVICE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/diary_data"
,
"diary_service.yaml"
)
#日记本收藏&取消收藏
DIARY_FAVOR
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/diary_data"
,
"favor.yaml"
)
# 日记本列表-日记贴点赞相关()
DIARY_VOTE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"hybrid_api_topic_request.yaml"
)
DIARY_VOTE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/hybrid_data"
,
"api_topic_vote.yaml"
)
# 日记本修改日记信息operation--目前好像直接用接口写无权限稍后解决
DIARY_OPERATION_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"diary_operation.yaml"
)
DIARY_OPERATION
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/diary_data"
,
"diary_operation.yaml"
)
# 日记本创建日记贴信息-
DIARY_UPDATE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"diary_update.yaml"
)
DIARY_UPDATE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/diary_data"
,
"diary_update.yaml"
)
# 日记本进入相册页
DIARY_ALBUM_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"hybrid_diary_request.yaml"
)
DIARY_ALBUM
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/hybrid_data"
,
"diary_album.yaml"
)
# 日记本列表-日记贴点赞相关()
DIARY_VOTE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"hybrid_api_topic_request.yaml"
)
DIARY_VOTE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/hybrid_data"
,
"api_topic_vote.yaml"
)
# 日记本&帖子&日记贴&帖子&问答各个详情页下方推荐内容
PERSONAL_RECOMMENDS_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"personal_recommends.yaml"
)
PERSONAL_RECOMMENDS
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/personal_data"
,
"personal_recommends.yaml"
)
...
...
@@ -55,14 +53,17 @@ TOPIC_SUB_COMMON = os.path.join(BASE_DIR, "backend_auto/test_backend_data/common
TOPIC_REPLY_CREATE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"topic_reply_create.yaml"
)
TOPIC_REPLY_CREATE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/topic_data"
,
"topic_reply_create.yaml"
)
# 日记贴-一级评论点赞&取消点赞topicreply
TOPIC_REPLY_VOTE_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"topicreply_vote.yaml"
)
TOPIC_REPLY_VOTE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/topic_data"
,
"reply_vote.yaml"
)
# 日记贴-收藏&取消收藏--config文件代表,data代表接口
TOPIC_FAVOR_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"user_request.yaml"
)
TOPIC_FAVOR
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/user_data"
,
"problem_favor.yaml"
)
# 日记贴-topic总的接口的请求配置
TOPIC_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"topic_request.yaml"
)
# 日记贴-详情页内容
...
...
@@ -83,7 +84,24 @@ TRACTATE_RELATED_SERVICE = os.path.join(BASE_DIR, "backend_auto/test_backend_dat
TRACTATE_REPLY
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/tractate_data"
,
"reply.yaml"
)
# 帖子详情页--收藏&取消收藏
TRACTATE_FAVOR
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/tractate_data"
,
"favor.yaml"
)
# 帖子详情页--点赞&取消点赞
TRACTATE_VOTE
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/tractate_data"
,
"vote.yaml"
)
# 帖子详情页--一级评论创建
TRACTATE_PUBLISH_REPLY
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/tractate_data"
,
"publish_reply.yaml"
)
# 问答详情页--问题详情
QUESTION_DETAIL
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/hybrid_data"
,
"question_v1.yaml"
)
# 问答详情页--回答列表
ANSWER_LIST
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/hybrid_data"
,
"question_new_answer_list.yaml"
)
# qa接口总的配置项--问答·相关
QA_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"qa_request.yaml"
)
# -问题的收藏&取消收藏
QA_FAVOR
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/qa_data"
,
"favor.yaml"
)
# -test的文件,尝试在不动原函数的基础上加参数而不是用默认参数。--没必要
# TEST_QA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/qa_data", "test.yaml")
...
...
test_backend_case/common_case/test_reply.py
View file @
9d990c2e
...
...
@@ -8,7 +8,7 @@ from all_backend_api.common_request import common_request
class
TestReply
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
DIARY_COMMON_REPLY
)
diary_common_reply_case
,
diary_common_reply_data
=
get_ids
(
data
,
"
diary_
common_reply"
)
diary_common_reply_case
,
diary_common_reply_data
=
get_ids
(
data
,
"common_reply"
)
@pytest.mark.parametrize
(
"param"
,
diary_common_reply_data
,
ids
=
diary_common_reply_case
)
def
test_reply
(
self
,
param
):
...
...
@@ -30,24 +30,6 @@ class TestReply:
assert
r
[
"data"
][
"reply_data"
][
0
][
"_type"
]
==
param
[
"type"
]
# 校验评论列表返回类型
# 帖子的评论列表
# r = common_request().tractate_common_reply(param["id"], param["type"])
# # print(r)
# if r["error"] == 0:
# assert r["error"] == param["assert1"]
# # 先判断有没有评论,然后判断里面需要的那些字段,如点赞字段,评论总数等,不传值,传空值
# if r["data"]["reply_data"]:
# assert r["data"]["reply_data"][0]["user_id"] is not None and r["data"]["reply_data"][0]["user_id"] is not "" # 用户id
# assert r["data"]["reply_data"][0]["user_portrait"] is not None and r["data"]["reply_data"][0]["user_portrait"] is not "" # 用户头像
# assert r["data"]["reply_data"][0]["gm_url"] is not None and r["data"]["reply_data"][0]["gm_url"] is not "" # 头像跳转链接
# assert r["data"]["reply_data"][0]["user_nickname"] is not None and r["data"]["reply_data"][0]["user_nickname"] is not "" # 用户名
# assert r["data"]["reply_data"][0]["content"] is not None and r["data"]["reply_data"][0]["content"] is not "" # 评论内容
# assert r["data"]["reply_data"][0]["reply_count"] is not None and r["data"]["reply_data"][0]["reply_count"] is not "" # 评论总数
# assert r["data"]["reply_data"][0]["reply_id"] is not None and r["data"]["reply_data"][0]["reply_id"] is not "" # 评论id
# assert r["data"]["reply_data"][0]["is_voted"] is not None and r["data"]["reply_data"][0]["is_voted"] is not "" # 是否点赞
# assert r["data"]["reply_data"][0]["_type"] == param["type4"] # 校验评论列表返回类型
...
...
test_backend_case/hybrid_case/test_question_new_answer_list.py
0 → 100644
View file @
9d990c2e
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.hybrid_request
import
hybrid_request
class
TestQuestionNewAnswerLiist
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
ANSWER_LIST
)
test_case
,
test_data
=
get_ids
(
data
,
"question_new_answer_list"
)
@pytest.mark.parametrize
(
"param"
,
test_data
,
ids
=
test_case
)
def
test_question_v1
(
self
,
param
):
r
=
hybrid_request
()
.
question_new_answer_list
(
param
[
"question_id"
])
if
r
[
"error"
]
==
0
:
if
r
[
"data"
][
"answers_list"
]:
# 看下是否有回答
assert
r
[
"data"
][
"answer_total_nums"
]
is
not
None
and
r
[
"data"
][
"answer_total_nums"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"is_author"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"is_author"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"content_level"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"content_level"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"first_reply_count"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"first_reply_count"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"content"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"content"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"comment_count"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"comment_count"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"like_num"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"like_num"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"is_voted"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"is_voted"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"id"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"id"
]
is
not
""
assert
r
[
"data"
][
"answers_list"
][
0
][
"answer_id"
]
is
not
None
and
r
[
"data"
][
"answers_list"
][
0
][
"answer_id"
]
is
not
""
else
:
assert
r
[
"message"
]
==
param
[
"message"
]
assert
r
[
"message"
]
==
param
[
"message"
]
# 如果没有点过赞,就先校验点赞之后再取消点赞。【最后保持取消点赞的状态】
test_backend_case/hybrid_case/test_question_v1.py
0 → 100644
View file @
9d990c2e
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.hybrid_request
import
hybrid_request
class
TestQuestionV1
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
QUESTION_DETAIL
)
test_case
,
test_data
=
get_ids
(
data
,
"question_v1"
)
@pytest.mark.parametrize
(
"param"
,
test_data
,
ids
=
test_case
)
def
test_question_v1
(
self
,
param
):
r
=
hybrid_request
()
.
question_v1
()
assert
r
[
"error"
]
==
param
[
"error"
]
if
r
[
"error"
]
==
0
:
assert
r
[
"config"
][
"has_login"
]
is
not
None
and
r
[
"config"
][
"has_login"
]
is
not
""
assert
r
[
"config"
][
"url_base"
]
is
not
None
and
r
[
"config"
][
"url_base"
]
is
not
""
assert
r
[
"config"
][
"host_url"
]
is
not
None
and
r
[
"config"
][
"host_url"
]
is
not
""
assert
r
[
"data"
][
"is_favored"
]
is
not
None
and
r
[
"data"
][
"is_favored"
]
is
not
""
assert
r
[
"data"
][
"answer_count"
]
is
not
None
and
r
[
"data"
][
"answer_count"
]
is
not
""
assert
r
[
"data"
][
"answer_level_lte2_nums"
]
is
not
None
and
r
[
"data"
][
"answer_level_lte2_nums"
]
is
not
""
assert
r
[
"data"
][
"answer_level_gte3_nums"
]
is
not
None
and
r
[
"data"
][
"answer_level_gte3_nums"
]
is
not
""
assert
r
[
"data"
][
"is_following"
]
is
not
None
and
r
[
"data"
][
"is_following"
]
is
not
""
assert
r
[
"data"
][
"id"
]
is
not
None
and
r
[
"data"
][
"id"
]
is
not
""
assert
r
[
"data"
][
"title"
]
is
not
None
and
r
[
"data"
][
"title"
]
is
not
""
assert
r
[
"data"
][
"content"
]
is
not
None
and
r
[
"data"
][
"content"
]
is
not
""
# 如果没有点过赞,就先校验点赞之后再取消点赞。【最后保持取消点赞的状态】
test_backend_case/qa_case/__init__.py
0 → 100644
View file @
9d990c2e
test_backend_case/qa_case/test_favor.py
0 → 100644
View file @
9d990c2e
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.qa_request
import
qa_request
class
TestFavor
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
QA_FAVOR
)
test_case
,
test_data
=
get_ids
(
data
,
"favor"
)
@pytest.mark.parametrize
(
"param"
,
test_data
,
ids
=
test_case
)
def
test_favor
(
self
,
param
):
r
=
qa_request
()
.
favor
(
param
[
"answer_id"
])
assert
r
[
"error"
]
==
param
[
"error"
]
r
=
qa_request
()
.
cancelfavor
(
param
[
"answer_id"
])
assert
r
[
"error"
]
==
param
[
"error"
]
test_backend_case/topic_case/test_vote.py
View file @
9d990c2e
...
...
@@ -22,11 +22,11 @@ class TestVote:
assert
vote
[
"error"
]
==
0
assert
vote
[
"message"
]
==
param
[
"message1"
]
# 取消点赞,回到取消点赞的状态
canclevote
=
topic_request
()
.
topic_canc
le
vote
(
param
[
"topic_id"
])
canclevote
=
topic_request
()
.
topic_canc
el
vote
(
param
[
"topic_id"
])
assert
canclevote
[
"error"
]
==
0
else
:
# 如果是已经点过赞的状态就直接取消点赞
canclevote
=
topic_request
()
.
topic_canc
le
vote
(
param
[
"topic_id"
])
canclevote
=
topic_request
()
.
topic_canc
el
vote
(
param
[
"topic_id"
])
assert
canclevote
[
"error"
]
==
0
assert
canclevote
[
"message"
]
==
param
[
"message2"
]
...
...
test_backend_case/tractate_case/test_publish_reply.py
0 → 100644
View file @
9d990c2e
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.tractate_request
import
tractate_request
class
TestPublishReply
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
TRACTATE_PUBLISH_REPLY
)
test_case
,
test_data
=
get_ids
(
data
,
"publish_reply"
)
@pytest.mark.parametrize
(
"param"
,
test_data
,
ids
=
test_case
)
def
test_publish_reply
(
self
,
param
):
r
=
tractate_request
()
.
publish_reply
(
param
[
"tractate_id"
],
param
[
"data_type"
],
param
[
"reply_id"
],
param
[
"content"
])
# print(r)
assert
r
[
"error"
]
==
param
[
"error"
]
if
r
[
"error"
]
==
0
:
assert
r
[
"data"
][
"reply_data"
][
"content"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"content"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"user_type"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"user_type"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"user_gm_url"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"user_gm_url"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"is_vote"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"is_vote"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"id"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"id"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"user_portrait"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"user_portrait"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"vote_num"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"vote_num"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"content"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"content"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"reply_count"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"reply_count"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"user_name"
]
is
not
None
and
r
[
"data"
][
"reply_data"
][
"user_name"
]
is
not
""
assert
r
[
"data"
][
"reply_data"
][
"content"
]
==
param
[
"content"
]
test_backend_case/tractate_case/test_vote.py
0 → 100644
View file @
9d990c2e
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.tractate_request
import
tractate_request
class
TestVote
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
TRACTATE_VOTE
)
test_case
,
test_data
=
get_ids
(
data
,
"tractate_vote"
)
@pytest.mark.parametrize
(
"param"
,
test_data
,
ids
=
test_case
)
def
test_vote
(
self
,
param
):
r
=
tractate_request
()
.
tractate_detail
(
param
[
"current_city_id"
],
param
[
"tractate_id"
],
param
[
"data_type"
])
if
r
[
"error"
]
==
0
:
assert
r
[
"error"
]
==
param
[
"assert1"
]
# 如果没有点过赞,就先校验点赞之后再取消点赞。【最后保持取消点赞的状态】
if
not
r
[
"data"
][
"tractate_list"
][
"is_voted"
]:
vote
=
tractate_request
()
.
tractate_vote
(
param
[
"tractate_id"
],
param
[
"data_type"
],
param
[
"reply_id"
])
assert
vote
[
"error"
]
==
0
assert
vote
[
"message"
]
==
param
[
"message1"
]
# 取消点赞,回到取消点赞的状态
canclevote
=
tractate_request
()
.
tractate_cancelvote
(
param
[
"tractate_id"
],
param
[
"data_type"
],
param
[
"reply_id"
])
assert
canclevote
[
"error"
]
==
0
else
:
# 如果是已经点过赞的状态就直接取消点赞
canclevote
=
tractate_request
()
.
tractate_cancelvote
(
param
[
"tractate_id"
],
param
[
"data_type"
],
param
[
"reply_id"
])
assert
canclevote
[
"message"
]
==
param
[
"message2"
]
test_backend_data/common_data/reply.yaml
View file @
9d990c2e
diary_
common_reply
:
common_reply
:
#日记本列表评论列表--校验
-
case
:
"
日记本列表评论列表--校验"
...
...
test_backend_data/hybrid_data/question_new_answer_list.yaml
0 → 100644
View file @
9d990c2e
question_new_answer_list
:
#问题详情页--回答列表
-
case
:
"
问题详情页--回答列表--有回答"
error
:
0
error1
:
1
message
:
"
没有更多了"
question_id
:
210502
assert
:
false
assert2
:
true
-
case
:
"
问题详情页--回答列表--无回答"
error
:
0
question_id
:
358247
assert
:
false
assert2
:
true
error1
:
1
message
:
"
没有更多了"
test_backend_data/hybrid_data/question_v1.yaml
0 → 100644
View file @
9d990c2e
question_v1
:
#问题详情
-
case
:
"
问题详情"
error
:
0
assert
:
false
assert2
:
true
test_backend_data/personal_data/personal_recommends.yaml
View file @
9d990c2e
personal_recommends
:
#
日记本
详情页推荐接口校验
#详情页推荐接口校验
-
case
:
"
校验详情页推荐数据--日记本"
current_city_id
:
"
beijiing"
...
...
test_backend_data/qa_data/__init__.py
0 → 100644
View file @
9d990c2e
test_backend_data/qa_data/favor.yaml
0 → 100644
View file @
9d990c2e
favor
:
#问题详情页--收藏&取消收藏校验
-
case
:
"
问题详情页--收藏&取消收藏校验-"
current_city_id
:
"
beijiing"
answer_id
:
357124
error
:
0
error1
:
1
message1
:
"
收藏成功"
message2
:
"
请登录后再试"
message3
:
"
取消收藏成功"
test_backend_data/tractate_data/publish_reply.yaml
0 → 100644
View file @
9d990c2e
publish_reply
:
#帖子发布一级评论&二级评论
-
case
:
"
贴子详情页--帖子发布一级评论--用接口校验可以发重复内容"
tractate_id
:
175152
content
:
"
太丰富发个刚刚"
data_type
:
"
user_post"
current_city_id
:
"
beijing"
reply_id
:
"
"
assert1
:
0
error
:
0
message1
:
"
点赞成功"
message2
:
"
取消点赞成功"
-
case
:
"
贴子详情页--帖子发布二级评论--用接口校验可以发重复内容"
tractate_id
:
175152
content
:
"
太丰富发个刚刚"
data_type
:
"
user_post"
current_city_id
:
"
beijing"
reply_id
:
"
2167124"
assert1
:
0
error
:
0
message1
:
"
点赞成功"
message2
:
"
取消点赞成功"
test_backend_data/tractate_data/vote.yaml
0 → 100644
View file @
9d990c2e
tractate_vote
:
#贴子详情页点赞
-
case
:
"
贴子详情页--点赞&取消点赞--用接口校验"
tractate_id
:
175152
reply_id
:
"
"
data_type
:
"
user_post"
current_city_id
:
"
beijing"
assert1
:
0
message1
:
"
点赞成功"
message2
:
"
取消点赞成功"
-
case
:
"
贴子详情页--一级评论点赞&取消点赞--用接口校验"
tractate_id
:
175152
reply_id
:
"
2167124"
data_type
:
"
user_post"
current_city_id
:
"
beijing"
assert1
:
0
message1
:
"
点赞成功"
message2
:
"
取消点赞成功"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment