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
91af40a1
Commit
91af40a1
authored
May 27, 2021
by
张淑琴
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/zsq_dev' into common_dev
parents
1c48469c
e0cd7508
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
13 deletions
+88
-13
im_request.py
all_backend_api/im_request.py
+15
-5
im_request.yaml
all_backend_api/im_request.yaml
+18
-2
path_setting.py
path_setting.py
+1
-0
test_auto_msg.py
test_backend_case/im_case/test_auto_msg.py
+3
-3
test_send_msg.py
test_backend_case/im_case/test_send_msg.py
+22
-0
auto_msg.yaml
test_backend_data/im_data/auto_msg.yaml
+0
-3
send_msg.yaml
test_backend_data/im_data/send_msg.yaml
+29
-0
No files found.
all_backend_api/im_request.py
View file @
91af40a1
...
...
@@ -6,7 +6,7 @@ class im_request(BaseRequest):
def
__init__
(
self
):
self
.
data
=
self
.
api_load
(
path_setting
.
CONVERSATION_DETAIL_CONFIG
)
def
conversation_detail
(
self
,
current_city_id
,
begin_msg_id
,
conversation_type
,
end_msg_id
,
referrer
):
def
conversation_detail
(
self
,
current_city_id
,
begin_msg_id
,
conversation_type
,
end_msg_id
,
referrer
):
self
.
params
[
"current_city_id"
]
=
current_city_id
self
.
params
[
"begin_msg_id"
]
=
begin_msg_id
self
.
params
[
"conversation_type"
]
=
conversation_type
...
...
@@ -14,17 +14,27 @@ class im_request(BaseRequest):
self
.
params
[
"referrer"
]
=
referrer
return
self
.
api_send
(
self
.
data
[
"conversation_detail"
])
def
auto_msg
(
self
,
version
,
uqid
,
trace_id
,
conversation_id
):
self
.
params
[
"version"
]
=
version
self
.
params
[
"uqid"
]
=
uqid
def
auto_msg
(
self
,
trace_id
,
conversation_id
):
self
.
params
[
"trace_id"
]
=
trace_id
self
.
params
[
"conversation_id"
]
=
conversation_id
return
self
.
api_send
(
self
.
data
[
"auto_msg"
])
def
send_msg
(
self
,
conversation_id
,
is_system
,
referrer
,
referrer_id
,
msg_type
,
content
,
extra
):
self
.
params
[
"conversation_id"
]
=
conversation_id
self
.
params
[
"is_system"
]
=
is_system
self
.
params
[
"referrer"
]
=
referrer
self
.
params
[
"referrer_id"
]
=
referrer_id
self
.
params
[
"msg_type"
]
=
msg_type
self
.
params
[
"content"
]
=
content
self
.
params
[
"extra"
]
=
extra
return
self
.
api_send
(
self
.
data
[
"send_msg"
])
if
__name__
==
'__main__'
:
print
(
im_request
()
.
conversation_detail
(
"beijing"
,
0
,
4
,
0
,
"message_home"
))
print
(
"第二个接口"
)
print
(
im_request
()
.
auto_msg
(
"7.42.2"
,
"1B519701-A4F5-453E-9D99-140B5AF697A0"
,
"2021/04/22/1722/70a1791606d5"
,
368
))
print
(
im_request
()
.
auto_msg
(
"2021/04/22/1722/70a1791606d5"
,
368
))
print
(
"send_msg"
)
print
(
im_request
()
.
send_msg
(
"368"
,
0
,
"message_home"
,
""
,
0
,
"您好,我想咨询一下"
,
{}))
...
...
all_backend_api/im_request.yaml
View file @
91af40a1
...
...
@@ -16,12 +16,27 @@ auto_msg:
method
:
post
url
:
/api/im/auto_msg
params
:
version
:
${version}
trace_id
:
${trace_id}
uqidd
:
${uqid}
data
:
conversation_id
:
${conversation_id}
json
:
{}
isLogin
:
1
#需要登录的接口
send_msg
:
method
:
post
url
:
/api/im/send_msg
params
:
{}
data
:
conversation_id
:
${conversation_id}
is_system
:
${is_system}
referrer
:
${referrer}
referrer_id
:
${referrer_id}
msg_type
:
${msg_type}
content
:
${content}
extra
:
${extra}
json
:
{}
isLogin
:
1
#需要登录的接口
\ No newline at end of file
path_setting.py
View file @
91af40a1
...
...
@@ -123,6 +123,7 @@ MESSAGE_READ = os.path.join(BASE_DIR, "backend_auto/test_backend_data/conversati
CONVERSATION_DETAIL_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"im_request.yaml"
)
CONVERSATION_DETAIL
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/im_data"
,
"conversation_detail.yaml"
)
AUTO_MSG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/im_data"
,
"auto_msg.yaml"
)
SEND_MSG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/im_data"
,
"send_msg.yaml"
)
#消息页未读数
UNREAD_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"notification_request.yaml"
)
UNREAD
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/notification_data"
,
"unread.yaml"
)
...
...
test_backend_case/im_case/test_auto_msg.py
View file @
91af40a1
...
...
@@ -6,13 +6,13 @@ from in_common.base_request import BaseRequest
from
all_backend_api.im_request
import
im_request
class
Test
ConversationDetail
:
class
Test
AutoMsg
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
AUTO_MSG
)
automsg_case
,
automsg_data
=
get_ids
(
data
,
"auto_msg"
)
@pytest.mark.parametrize
(
"param"
,
automsg_data
,
ids
=
automsg_case
)
def
test_
conversation_detail
(
self
,
param
):
r
=
im_request
()
.
auto_msg
(
param
[
"
version"
],
param
[
"uqid"
],
param
[
"
trace_id"
],
param
[
"conversation_id"
])
def
test_
auto_msg
(
self
,
param
):
r
=
im_request
()
.
auto_msg
(
param
[
"trace_id"
],
param
[
"conversation_id"
])
if
r
[
"error"
]
==
0
:
assert
r
[
"data"
][
"send_result"
]
==
param
[
"assert"
]
test_backend_case/im_case/test_send_msg.py
0 → 100644
View file @
91af40a1
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
TestSendMsg
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
SEND_MSG
)
sendmsg_case
,
sendmsg_data
=
get_ids
(
data
,
"send_msg"
)
@pytest.mark.parametrize
(
"param"
,
sendmsg_data
,
ids
=
sendmsg_case
)
def
test_send_msg
(
self
,
param
):
r
=
im_request
()
.
send_msg
(
param
[
"conversation_id"
],
param
[
"is_system"
],
param
[
"referrer"
],
param
[
"referrer_id"
],
param
[
"msg_type"
],
param
[
"content"
],
param
[
"extra"
])
print
(
r
)
if
r
[
"error"
]
==
0
:
assert
r
[
"data"
][
"conversation_type"
]
==
param
[
"assert_conversation_type"
]
assert
r
[
"data"
][
"message_type"
]
==
param
[
"assert_message_type"
]
if
r
[
"error"
]
==
1
:
assert
r
[
"message"
]
==
param
[
"assert_message"
]
test_backend_data/im_data/auto_msg.yaml
View file @
91af40a1
...
...
@@ -2,8 +2,6 @@ auto_msg:
#验证成功case
-
case
:
"
请求成功,有数据返回"
version
:
7.42
uqid
:
"
1B519701-A4F5-453E-9D99-140B5AF697A0"
trace_id
:
"
2021/04/22/1722/70a1791606d5"
conversation_id
:
368
assert
:
True
\ No newline at end of file
test_backend_data/im_data/send_msg.yaml
0 → 100644
View file @
91af40a1
send_msg
:
#验证成功case
-
case
:
"
给咨询师发送消息成功"
#current_city_id: beijing
conversation_id
:
368
is_system
:
0
referrer
:
"
message_home"
referrer_id
:
"
"
msg_type
:
0
content
:
"
您好,我想咨询一下---"
extra
:
"
"
assert_conversation_type
:
4
assert_message_type
:
0
#验证失败case
-
case
:
"
给咨询师发送消息失败"
#current_city_id: beijing
conversation_id
:
463465
is_system
:
0
referrer
:
"
message_home"
referrer_id
:
"
"
msg_type
:
0
content
:
"
您好,我想咨询一下---"
extra
:
{}
assert_message
:
"
服务器开小差了~"
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