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
867e686c
Commit
867e686c
authored
Aug 13, 2021
by
张淑琴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
私信机器人
parent
719174ec
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
227 additions
and
0 deletions
+227
-0
im_request.py
all_backend_api/im_request.py
+18
-0
im_request.yaml
all_backend_api/im_request.yaml
+25
-0
path_setting.py
path_setting.py
+4
-0
test_robot_get_second.py
test_backend_case/im_case/test_robot_get_second.py
+19
-0
test_robot_send_msg.py
test_backend_case/im_case/test_robot_send_msg.py
+20
-0
robot_get_second.yaml
test_backend_data/im_data/robot_get_second.yaml
+31
-0
robot_send_msg.yaml
test_backend_data/im_data/robot_send_msg.yaml
+110
-0
No files found.
all_backend_api/im_request.py
View file @
867e686c
...
...
@@ -29,12 +29,30 @@ class im_request(BaseRequest):
self
.
params
[
"extra"
]
=
extra
return
self
.
api_send
(
self
.
data
[
"send_msg"
])
def
robot_get_second
(
self
,
page_type
):
" 获取页面触发私信时间 "
self
.
params
[
"page_type"
]
=
page_type
return
self
.
api_send
(
self
.
data
[
"robot_get_second"
])
def
robot_send_msg
(
self
,
hospital_id
,
is_system
,
page_type
,
req_source
,
target_user_id
,
version
):
#给用户发私信
self
.
params
[
"hospital_id"
]
=
hospital_id
self
.
params
[
"is_system"
]
=
is_system
self
.
params
[
"page_type"
]
=
page_type
self
.
params
[
"req_source"
]
=
req_source
self
.
params
[
"target_user_id"
]
=
target_user_id
self
.
params
[
"version"
]
=
version
return
self
.
api_send
(
self
.
data
[
"robot_send_msg"
])
if
__name__
==
'__main__'
:
print
(
im_request
()
.
conversation_detail
(
"beijing"
,
0
,
4
,
0
,
"message_home"
))
print
(
"第二个接口"
)
print
(
im_request
()
.
auto_msg
(
"2021/04/22/1722/70a1791606d5"
,
368
))
print
(
"send_msg"
)
print
(
im_request
()
.
send_msg
(
"368"
,
0
,
"message_home"
,
""
,
0
,
"您好,我想咨询一下"
,
{}))
print
(
im_request
()
.
robot_get_second
(
"3"
))
print
(
im_request
()
.
robot_send_msg
(
"715368769fea4a1ba0c85979112ed154"
,
1
,
"3"
,
"gengmei"
,
33909952
,
"7.46.0"
))
...
...
all_backend_api/im_request.yaml
View file @
867e686c
...
...
@@ -39,4 +39,28 @@ send_msg:
extra
:
${extra}
json
:
{}
isLogin
:
1
#需要登录的接口
robot_get_second
:
method
:
get
url
:
/api/im/robot/get_second
params
:
page_type
:
${page_type}
data
:
{}
json
:
{}
isLogin
:
1
#需要登录的接口
robot_send_msg
:
method
:
post
url
:
/api/im/robot/send_msg
params
:
version
:
${version}
data
:
hospital_id
:
${hospital_id}
is_system
:
${is_system}
page_type
:
${page_type}
req_source
:
${req_source}
target_user_id
:
${target_user_id}
json
:
{}
isLogin
:
1
#需要登录的接口
\ No newline at end of file
path_setting.py
View file @
867e686c
...
...
@@ -321,6 +321,10 @@ SEND_MSG = os.path.join(BASE_DIR, "backend_auto/test_backend_data/im_data", "sen
#发送消息
PRIVATE_CONVERSATION_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"private_conversation_request.yaml"
)
PRIVATE_CONVERSATION
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/private_conversation_data"
,
"private_conversation.yaml"
)
#私信机器人-获取页面触发私信时间
ROBOT_GET_SECOND
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/im_data"
,
"robot_get_second.yaml"
)
#私信机器人-给用户发送私信
ROBOT_SEND_MSG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/im_data"
,
"robot_send_msg.yaml"
)
HOME_V5_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"service_request.yaml"
)
HOME_V5
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/service_data"
,
"home_v5.yaml"
)
...
...
test_backend_case/im_case/test_robot_get_second.py
0 → 100644
View file @
867e686c
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.im_request
import
im_request
class
TestRobotGetSecond
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
ROBOT_GET_SECOND
)
robot_get_second_case
,
robot_get_second_data
=
get_ids
(
data
,
"robot_get_second"
)
@pytest.mark.parametrize
(
"param"
,
robot_get_second_data
,
ids
=
robot_get_second_case
)
def
test_robot_get_second
(
self
,
param
):
r
=
im_request
()
.
robot_get_second
(
param
[
"page_type"
])
print
(
r
)
if
r
[
"error"
]
==
0
:
assert
r
[
"data"
][
"second"
]
==
param
[
"assert"
]
test_backend_case/im_case/test_robot_send_msg.py
0 → 100644
View file @
867e686c
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.im_request
import
im_request
class
TestRobotSendMsg
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
ROBOT_SEND_MSG
)
robot_send_msg_case
,
robot_send_msg_data
=
get_ids
(
data
,
"robot_send_msg"
)
@pytest.mark.parametrize
(
"param"
,
robot_send_msg_data
,
ids
=
robot_send_msg_case
)
def
test_robot_send_msg
(
self
,
param
):
r
=
im_request
()
.
robot_send_msg
(
param
[
"hospital_id"
],
param
[
"is_system"
],
param
[
"page_type"
],
param
[
"req_source"
],
param
[
"target_user_id"
],
param
[
"version"
])
print
(
r
)
assert
r
[
"error"
]
==
param
[
"assert"
]
#if r["error"] == 0:
#assert r["data"]["second"] == param["assert"]
test_backend_data/im_data/robot_get_second.yaml
0 → 100644
View file @
867e686c
robot_get_second
:
#获取页面触发私信时间-商详页case
-
case
:
"
商详页"
page_type
:
"
1"
assert
:
5
#获取页面触发私信时间-机构主页case
-
case
:
"
机构主页"
page_type
:
"
2"
assert
:
5
#获取页面触发私信时间-医生主页case
-
case
:
"
医生主页"
page_type
:
"
3"
assert
:
5
#获取页面触发私信时间-综搜页case
-
case
:
"
综搜页"
page_type
:
"
4"
assert
:
1
#获取页面触发私信时间-聚合页case
-
case
:
"
聚合页"
page_type
:
"
5"
assert
:
1
\ No newline at end of file
test_backend_data/im_data/robot_send_msg.yaml
0 → 100644
View file @
867e686c
robot_send_msg
:
#给用户发私信-商详页普通用户case
-
case
:
"
商详页"
version
:
"
7.46.0"
page_type
:
"
1"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33909952
assert
:
0
#给用户发私信-商详页医生用户case
-
case
:
"
商详页"
version
:
"
7.46.0"
page_type
:
"
1"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33910245
assert
:
0
#给用户发私信-机构主页普通用户case
-
case
:
"
机构主页"
version
:
"
7.46.0"
page_type
:
"
2"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33909952
assert
:
0
#给用户发私信-机构主页医生用户case
-
case
:
"
机构主页"
version
:
"
7.46.0"
page_type
:
"
2"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33910245
assert
:
0
#给用户发私信-医生主页普通用户case
-
case
:
"
医生主页普通用户"
version
:
"
7.46.0"
page_type
:
"
3"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33909952
assert
:
0
#给用户发私信-医生主页医生用户case
-
case
:
"
医生主页医生用户"
version
:
"
7.46.0"
page_type
:
"
3"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33910245
assert
:
0
#给用户发私信-综搜页普通用户case
-
case
:
"
综搜页普通用户"
version
:
"
7.46.0"
page_type
:
"
4"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33909952
assert
:
0
#给用户发私信-综搜页医生用户case
-
case
:
"
综搜页医生用户"
version
:
"
7.46.0"
page_type
:
"
4"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33910245
assert
:
0
#给用户发私信-聚合页普通用户case
-
case
:
"
聚合页"
version
:
"
7.46.0"
page_type
:
"
5"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33909952
assert
:
0
#给用户发私信-聚合页医生用户case
-
case
:
"
聚合页"
version
:
"
7.46.0"
page_type
:
"
5"
hospital_id
:
"
715368769fea4a1ba0c85979112ed154"
is_system
:
1
req_source
:
"
gengmei"
target_user_id
:
33910245
assert
:
0
\ No newline at end of file
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