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
655ce221
Commit
655ce221
authored
Mar 28, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用例
parent
73ecf256
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
1 deletion
+60
-1
TestCase/inbox/test_07_ticketDetail.py
TestCase/inbox/test_07_ticketDetail.py
+13
-0
TestData/inbox/ticketDetail_test_data.py
TestData/inbox/ticketDetail_test_data.py
+4
-0
TestFile/inbox/ticketDetail_select.py
TestFile/inbox/ticketDetail_select.py
+27
-0
Utils/req_handler.py
Utils/req_handler.py
+1
-1
YamlCase/inbox/ticketDetail.yaml
YamlCase/inbox/ticketDetail.yaml
+15
-0
No files found.
TestCase/inbox/test_07_ticketDetail.py
0 → 100644
View file @
655ce221
import
pytest
from
Utils
import
yaml_handler
from
Utils
import
req_handler
from
TestData.inbox.ticketDetail_test_data
import
ticketDetailData
class
TestTiocketDetail
:
yaml_path
=
r
'inbox\ticketDetail.yaml'
yaml_data
=
yaml_handler
.
yaml_handler
.
get_case
(
yaml_path
)
@
pytest
.
mark
.
parametrize
(
'case'
,
yaml_data
)
def
test_ticketDetail
(
self
,
case
):
print
(
case
)
req_handler
.
ReqHandler
.
send_requests
(
case
=
case
,
var_class
=
ticketDetailData
)
TestData/inbox/ticketDetail_test_data.py
0 → 100644
View file @
655ce221
from
Utils.global_variate
import
Global
class
ticketDetailData
(
Global
):
pass
\ No newline at end of file
TestFile/inbox/ticketDetail_select.py
0 → 100644
View file @
655ce221
from
Utils.sql_handler
import
test_env_conn
from
TestData.inbox.ticketDetail_test_data
import
ticketDetailData
ticket_select_sql
=
f
'select * from `im_room` where `cate_id` =
{
ticketDetailData
.
brandId
}
and `status` = 1 and `is_ignore` = 0'
ticket_select_result
=
test_env_conn
.
select_one_value
(
sql
=
ticket_select_sql
)
ticket_room_id
=
ticket_select_result
[
'room_id'
]
ticket_id
=
ticket_select_result
[
'id'
]
customer_id
=
ticket_select_result
[
'first_send_uid'
]
setattr
(
ticketDetailData
,
'ticket_room_id'
,
ticket_room_id
)
setattr
(
ticketDetailData
,
'ticket_id'
,
ticket_id
)
setattr
(
ticketDetailData
,
'customer_id'
,
customer_id
)
customer_select_sql
=
f
'select * from `customer` where id =
{
customer_id
}
'
customer_select_result
=
test_env_conn
.
select_one_value
(
sql
=
customer_select_sql
)
customer_time_zone
=
customer_select_result
[
'time_zone'
]
customer_location
=
customer_select_result
[
'location'
]
customer_email
=
customer_select_result
[
'email'
]
customer_phone
=
customer_select_result
[
'phone'
]
customer_is_visitor
=
customer_select_result
[
'is_visitor'
]
customer_last_msg_time
=
ticket_select_result
[
'last_msg_time'
]
setattr
(
ticketDetailData
,
'customer_time_zone'
,
customer_time_zone
)
setattr
(
ticketDetailData
,
'customer_location'
,
customer_location
)
setattr
(
ticketDetailData
,
'customer_email'
,
customer_email
)
setattr
(
ticketDetailData
,
'customer_phone'
,
customer_phone
)
setattr
(
ticketDetailData
,
'customer_is_visitor'
,
customer_is_visitor
)
setattr
(
ticketDetailData
,
'customer_last_msg_time'
,
customer_last_msg_time
)
Utils/req_handler.py
View file @
655ce221
...
@@ -43,6 +43,7 @@ class ReqHandler:
...
@@ -43,6 +43,7 @@ class ReqHandler:
def
send_requests
(
self
,
case
,
var_class
):
def
send_requests
(
self
,
case
,
var_class
):
try
:
try
:
if
isinstance
(
case
,
dict
):
if
isinstance
(
case
,
dict
):
title
=
case
[
'title'
]
if
case
.
get
(
'before_sql'
):
if
case
.
get
(
'before_sql'
):
sql
=
case
[
'before_sql'
]
sql
=
case
[
'before_sql'
]
while
sql
[
0
]
==
'
\\
'
or
sql
[
0
]
==
'/'
:
while
sql
[
0
]
==
'
\\
'
or
sql
[
0
]
==
'/'
:
...
@@ -51,7 +52,6 @@ class ReqHandler:
...
@@ -51,7 +52,6 @@ class ReqHandler:
content
=
f
.
read
()
content
=
f
.
read
()
exec
(
content
)
exec
(
content
)
case
=
self
.
params_handler
(
self
,
case
=
case
,
var_class
=
var_class
)
case
=
self
.
params_handler
(
self
,
case
=
case
,
var_class
=
var_class
)
title
=
case
[
'title'
]
if
case
.
get
(
'ws'
):
if
case
.
get
(
'ws'
):
#识别到ws字段后,直接走ws_request函数,不继续往下面走
#识别到ws字段后,直接走ws_request函数,不继续往下面走
self
.
ws_requests
(
self
,
case
)
self
.
ws_requests
(
self
,
case
)
...
...
YamlCase/inbox/ticketDetail.yaml
0 → 100644
View file @
655ce221
api1
:
title
:
检查会话详情
url
:
/api/v1/chatRoom/roomDetail
method
:
post
before_sql
:
inbox/ticketDetail_select.py
data
:
{
"
roomId"
:
"
${ticket_room_id}"
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
code"
:
0
}
-
eq
:
{
"
$.data.timeZone"
:
"
${customer_time_zone}"
}
-
eq
:
{
"
$.data.location"
:
"
${customer_location}"
}
-
eq
:
{
"
$.data.email"
:
"
${customer_email}"
}
-
eq
:
{
"
$.data.phone"
:
"
${customer_phone}"
}
-
eq
:
{
"
$.data.isVisitor"
:
"
${customer_is_visitor}"
}
-
eq
:
{
"
$.data.customerId"
:
"
${customer_id}"
}
-
eq
:
{
"
$.data.lastSeenTime"
:
"
${customer_last_msg_time}"
}
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