Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
willdesk_apiauto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
29
Issues
29
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
桦生 詹
willdesk_apiauto
Commits
9633580d
Commit
9633580d
authored
Mar 26, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用例
parent
66f98af5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
1 deletion
+59
-1
TestCase/inbox/test_06_channel.py
TestCase/inbox/test_06_channel.py
+13
-0
TestData/inbox/channel_test_data.py
TestData/inbox/channel_test_data.py
+7
-0
TestFile/inbox/channel_select.py
TestFile/inbox/channel_select.py
+17
-0
YamlCase/inbox/channel.yaml
YamlCase/inbox/channel.yaml
+13
-0
YamlCase/inbox/livechat.yaml
YamlCase/inbox/livechat.yaml
+8
-0
main.py
main.py
+1
-1
No files found.
TestCase/inbox/test_06_channel.py
0 → 100644
View file @
9633580d
import
pytest
from
Utils
import
yaml_handler
from
Utils
import
req_handler
from
TestData.inbox.channel_test_data
import
channelData
class
TestChannel
:
yaml_path
=
r
'inbox\channel.yaml'
yaml_data
=
yaml_handler
.
yaml_handler
.
get_case
(
yaml_path
)
@
pytest
.
mark
.
parametrize
(
'case'
,
yaml_data
)
def
test_channel
(
self
,
case
):
print
(
case
)
req_handler
.
ReqHandler
.
send_requests
(
case
=
case
,
var_class
=
channelData
)
TestData/inbox/channel_test_data.py
0 → 100644
View file @
9633580d
from
Utils.global_variate
import
Global
class
channelData
(
Global
):
pass
# brandId = 6052
# shopId = 7238
TestFile/inbox/channel_select.py
0 → 100644
View file @
9633580d
from
Utils.sql_handler
import
test_env_conn
from
TestData.inbox.channel_test_data
import
channelData
channel_select_sql
=
f
'select * from `resource_item` where brand_id =
{
channelData
.
brandId
}
and resource_id in (7,2,3,4,6)'
#2:livechat 3:facebook 4:email 6:ins 7:whatsapp
channel_select_result
=
test_env_conn
.
select_many_value
(
sql
=
channel_select_sql
)
channel_id
=
channel_select_result
[
0
][
'id'
]
channel_name
=
channel_select_result
[
0
][
'name'
]
channel_rel_id
=
channel_select_result
[
0
][
'rel_id'
]
channel_resource_id
=
channel_select_result
[
0
][
'resource_id'
]
setattr
(
channelData
,
'channel_id'
,
channel_id
)
setattr
(
channelData
,
'channel_name'
,
channel_name
)
setattr
(
channelData
,
'channel_resource_id'
,
channel_resource_id
)
channel_open_room_select_sql
=
f
'select * from `im_room` where site_id =
{
channel_rel_id
}
and status = 1'
channel_open_room_select_result
=
test_env_conn
.
select_many_value
(
sql
=
channel_open_room_select_sql
)
setattr
(
channelData
,
'channel_open_room_num'
,
len
(
channel_open_room_select_result
))
YamlCase/inbox/channel.yaml
0 → 100644
View file @
9633580d
api1
:
title
:
检查渠道信息
url
:
/api/v1/resource/getResourceItemList
method
:
post
before_sql
:
inbox/channel_select.py
data
:
{
"
resourceType"
:
"
channel"
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.list[?(@.id
==
'${channel_id}')].name"
:
"
${channel_name}"
}
-
eq
:
{
"
$.data.list[?(@.id
==
'${channel_id}')].openCount"
:
"
${channel_open_room_num}"
}
-
eq
:
{
"
$.data.list[?(@.id
==
'${channel_id}')].resourceId"
:
"
${channel_resource_id}"
}
YamlCase/inbox/livechat.yaml
View file @
9633580d
...
@@ -158,3 +158,11 @@ api16:
...
@@ -158,3 +158,11 @@ api16:
-
eq
:
{
"
$.data.list[8].content"
:
"
${img}"
}
-
eq
:
{
"
$.data.list[8].content"
:
"
${img}"
}
-
like
:
{
"
$.data.list[8].senderUid"
:
"
${userId}"
}
-
like
:
{
"
$.data.list[8].senderUid"
:
"
${userId}"
}
api17
:
title
:
b端主动发起会话 - 笔记
ws
:
willdesk
action
:
sendmsg
data
:
type
:
text
roomId
:
"
${roomId}"
isNote
:
true
\ No newline at end of file
main.py
View file @
9633580d
...
@@ -4,7 +4,7 @@ from Utils.sql_handler import test_env_conn
...
@@ -4,7 +4,7 @@ from Utils.sql_handler import test_env_conn
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
pytest
.
main
([
'-vs'
,
r
'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase
\inbox\test_05_team.py
'
,
f
'--alluredir=./allureReports'
,
'--clean-alluredir'
])
pytest
.
main
([
'-vs'
,
r
'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase'
,
f
'--alluredir=./allureReports'
,
'--clean-alluredir'
])
finally
:
finally
:
test_env_conn
.
close_db
()
#关闭数据库链接
test_env_conn
.
close_db
()
#关闭数据库链接
...
...
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