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
d8b3345b
Commit
d8b3345b
authored
Apr 24, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用例
parent
2bb4d0a8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
283 additions
and
1 deletion
+283
-1
TestCase/setting/test_05_survey.py
TestCase/setting/test_05_survey.py
+13
-0
TestCase/setting/test_06_macro.py
TestCase/setting/test_06_macro.py
+13
-0
TestData/setting/macro_test_data.py
TestData/setting/macro_test_data.py
+12
-0
TestData/setting/survey_test_data.py
TestData/setting/survey_test_data.py
+4
-0
TestFile/setting/macro/macro_select.py
TestFile/setting/macro/macro_select.py
+61
-0
Utils/mockData_handler.py
Utils/mockData_handler.py
+4
-0
YamlCase/customer/customer.yaml
YamlCase/customer/customer.yaml
+0
-1
YamlCase/setting/macro.yaml
YamlCase/setting/macro.yaml
+109
-0
YamlCase/setting/survey.yaml
YamlCase/setting/survey.yaml
+67
-0
No files found.
TestCase/setting/test_05_survey.py
0 → 100644
View file @
d8b3345b
import
pytest
from
Utils
import
yaml_handler
from
Utils
import
req_handler
from
TestData.setting.survey_test_data
import
surveyData
class
TestSurvey
:
yaml_path
=
r
'setting/survey.yaml'
yaml_data
=
yaml_handler
.
yaml_handler
.
get_case
(
yaml_path
)
@
pytest
.
mark
.
flaky
(
reruns
=
surveyData
.
rerun
,
reruns_delay
=
surveyData
.
rerun_delay
)
@
pytest
.
mark
.
parametrize
(
'case'
,
yaml_data
)
def
test_survey
(
self
,
case
):
req_handler
.
ReqHandler
.
send_requests
(
case
=
case
,
var_class
=
surveyData
)
TestCase/setting/test_06_macro.py
0 → 100644
View file @
d8b3345b
import
pytest
from
Utils
import
yaml_handler
from
Utils
import
req_handler
from
TestData.setting.macro_test_data
import
macroData
class
TestMacro
:
yaml_path
=
r
'setting/macro.yaml'
yaml_data
=
yaml_handler
.
yaml_handler
.
get_case
(
yaml_path
)
@
pytest
.
mark
.
flaky
(
reruns
=
macroData
.
rerun
,
reruns_delay
=
macroData
.
rerun_delay
)
@
pytest
.
mark
.
parametrize
(
'case'
,
yaml_data
)
def
test_macro
(
self
,
case
):
req_handler
.
ReqHandler
.
send_requests
(
case
=
case
,
var_class
=
macroData
)
TestData/setting/macro_test_data.py
0 → 100644
View file @
d8b3345b
from
Utils.global_variate
import
Global
class
macroData
(
Global
):
append_macro_perm_type
=
1
append_macro_title
=
'autotest_macro'
macro_content_append
=
'autotest_macro_content'
append_macro_content
=
r
'{\"contentList\":\"%s\\n\",\"attachmentList\":[]}'
%
macro_content_append
update_macro_perm_type
=
2
update_macro_title
=
'autotest_macro2'
macro_content_update
=
'new_update_macro_content'
update_macro_content
=
r
'{\"contentList\":\"%s\\n\",\"attachmentList\":[]}'
%
macro_content_update
TestData/setting/survey_test_data.py
0 → 100644
View file @
d8b3345b
from
Utils.global_variate
import
Global
class
surveyData
(
Global
):
survey_content
=
'<p>autotest_survey_content</p>'
\ No newline at end of file
TestFile/setting/macro/macro_select.py
0 → 100644
View file @
d8b3345b
from
Utils.sql_handler
import
test_env_conn
from
TestData.setting.macro_test_data
import
macroData
from
Utils.mockData_handler
import
data_handler
macro_select_sql
=
f
'select * from `macro` where brand_id =
{
macroData
.
brandId
}
and deleted_at is NULL'
macro_select_result
=
test_env_conn
.
select_many_value
(
sql
=
macro_select_sql
)
if
macro_select_result
:
macro_id_list
=
tuple
([
i
[
'macro_id'
]
for
i
in
macro_select_result
])
macro_num_select_sql
=
f
'select * from `macro_permission` where macro_id in
{
macro_id_list
}
'
macro_num_select_result
=
test_env_conn
.
select_many_value
(
sql
=
macro_num_select_sql
)
team_macro_num
=
0
brand_macro_num
=
0
user_macro_num
=
0
for
macro
in
macro_num_select_result
:
if
macro
[
'perm_type'
]
==
1
:
brand_macro_num
+=
1
elif
macro
[
'perm_type'
]
==
2
:
user_macro_num
+=
1
elif
macro
[
'perm_type'
]
==
3
:
team_macro_num
+=
1
setattr
(
macroData
,
'brand_macro_num'
,
brand_macro_num
)
setattr
(
macroData
,
'user_macro_num'
,
user_macro_num
)
setattr
(
macroData
,
'team_macro_num'
,
team_macro_num
)
for
i
in
macro_select_result
:
if
i
[
'title'
]
==
macroData
.
append_macro_title
:
append_macro_id
=
i
[
'macro_id'
]
break
macro_id
=
macro_select_result
[
0
][
'macro_id'
]
macro_title
=
macro_select_result
[
0
][
'title'
]
macro_content
=
macro_select_result
[
0
][
'content'
]
macro_sorts
=
macro_select_result
[
0
][
'sorts'
]
macro_clicks
=
macro_select_result
[
0
][
'clicks'
]
macro_brand_id
=
[
macro_select_result
[
0
][
'brand_id'
]]
macro_create_by_name
=
macro_select_result
[
0
][
'create_by_name'
]
macro_create_by_id
=
macro_select_result
[
0
][
'create_by_uid'
]
else
:
append_macro_id
=
data_handler
.
random_id
()
macro_insert_sql
=
f
'''INSERT INTO `macro` (macro_id,title,content,sorts,clicks,brand_id,create_by_name,create_by_uid,deleted_at,update_at,create_at) VALUES
('
{
append_macro_id
}
','
{
macroData
.
append_macro_title
}
','
{
macroData
.
append_macro_content
}
',1,0,
{
macroData
.
brandId
}
,'
{
macroData
.
userName
}
',
{
macroData
.
userId
}
,NULL,'2024-04-23 14:54:31','2024-04-23 14:54:31');
'''
test_env_conn
.
execute_sql
(
sql
=
macro_insert_sql
)
setattr
(
macroData
,
'brand_macro_num'
,
1
)
setattr
(
macroData
,
'team_macro_num'
,
0
)
setattr
(
macroData
,
'user_macro_num'
,
0
)
macro_id
=
append_macro_id
macro_title
=
macroData
.
append_macro_title
macro_content
=
macroData
.
append_macro_content
macro_sorts
=
1
macro_clicks
=
0
macro_brand_id
=
[
macroData
.
brandId
]
macro_create_by_name
=
macroData
.
userName
macro_create_by_id
=
macroData
.
userId
setattr
(
macroData
,
'macro_id'
,
macro_id
)
setattr
(
macroData
,
'append_macro_id'
,
append_macro_id
)
setattr
(
macroData
,
'macro_title'
,
macro_title
)
setattr
(
macroData
,
'macro_content'
,
macro_content
)
setattr
(
macroData
,
'macro_sorts'
,
macro_sorts
)
setattr
(
macroData
,
'macro_clicks'
,
macro_clicks
)
setattr
(
macroData
,
'macro_brand_id'
,
macro_brand_id
)
setattr
(
macroData
,
'macro_create_by_name'
,
macro_create_by_name
)
setattr
(
macroData
,
'macro_create_by_id'
,
macro_create_by_id
)
\ No newline at end of file
Utils/mockData_handler.py
View file @
d8b3345b
...
...
@@ -11,4 +11,8 @@ class MockData:
name
=
"autotest_"
+
''
.
join
(
random
.
choices
(
string
.
ascii_lowercase
+
string
.
digits
,
k
=
5
))
return
name
def
random_id
(
self
):
id
=
''
.
join
(
random
.
choices
(
string
.
ascii_lowercase
+
string
.
digits
,
k
=
13
))
return
id
data_handler
=
MockData
()
YamlCase/customer/customer.yaml
View file @
d8b3345b
...
...
@@ -12,7 +12,6 @@ api1:
-
eq
:
{
"
$.data.list[?(@.id
==
'${customer_id}')].phone"
:
"
${customer_phone}"
}
-
eq
:
{
"
$.data.list[?(@.id
==
'${customer_id}')].location"
:
"
${customer_location}"
}
-
eq
:
{
"
$.data.list[?(@.id
==
'${customer_id}')].timeZone"
:
"
${customer_timezone}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['list'])
==
${customer_num}"
}
api2
:
title
:
新建一个顾客
...
...
YamlCase/setting/macro.yaml
0 → 100644
View file @
d8b3345b
api1
:
title
:
新增快捷回复
url
:
/api/v1/macro/add
method
:
post
data
:
{
"
title"
:
"
${append_macro_title}"
,
"
related_id"
:[
"
${brandId}"
],
"
content"
:
"
${append_macro_content}"
,
"
perm_type"
:
"
${append_macro_perm_type}"
,
"
sorts"
:
1
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api2
:
title
:
检查快捷回复列表
url
:
/api/v1/macro/getAllList?v=${v}
method
:
get
before_sql
:
setting/macro/macro_select.py
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].title"
:
"
${macro_title}"
}
-
in
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].content"
:
"
${macro_content_append}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].permType"
:
"
${append_macro_perm_type}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].sorts"
:
"
${macro_sorts}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].clicks"
:
"
${macro_clicks}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].relatedId"
:
"
${macro_brand_id}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].createByUid"
:
"
${macro_create_by_id}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${macro_id}')].createByName"
:
"
${macro_create_by_name}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['brandList'])
==
${brand_macro_num}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['userList'])
==
${user_macro_num}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['teamList'])
==
${team_macro_num}"
}
api3
:
title
:
检查inbox处快捷回复列表
url
:
/api/v1/macro/getList?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].title"
:
"
${append_macro_title}"
}
-
in
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].content"
:
"
${macro_content_append}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].brandId"
:
"
${brandId}"
}
-
eq
:
{
"
$.data.brandList[?(@.macroId
==
'${append_macro_id}')].relatedId"
:
[
"
${brandId}"
]}
api4
:
title
:
更新快捷回复
url
:
/api/v1/macro/edit
method
:
post
data
:
{
"
macro_id"
:
"
${append_macro_id}"
,
"
title"
:
"
${update_macro_title}"
,
"
related_id"
:[
"
${userId}"
],
"
content"
:
"
${update_macro_content}"
,
"
perm_type"
:
"
${update_macro_perm_type}"
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api5
:
title
:
选中macro
url
:
/api/v1/macro/logClick
method
:
post
data
:
{
"
macro_id"
:
"
${append_macro_id}"
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api6
:
title
:
检查更新后的快捷回复列表
url
:
/api/v1/macro/getAllList?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].title"
:
"
${update_macro_title}"
}
-
in
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].content"
:
"
${macro_content_update}"
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].clicks"
:
1
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].relatedId"
:
[
"
${userId}"
]}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].permType"
:
"
${update_macro_perm_type}"
}
-
not_in
:
{
"
$.data.brandList[*].macroId"
:
"
${append_macro_id}"
}
api7
:
title
:
检查inbox处快捷回复列表
url
:
/api/v1/macro/getList?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].title"
:
"
${update_macro_title}"
}
-
in
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].content"
:
"
${macro_content_update}"
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].clicks"
:
1
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].brandId"
:
"
${brandId}"
}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].relatedId"
:
[
"
${userId}"
]}
-
eq
:
{
"
$.data.userList[?(@.macroId
==
'${append_macro_id}')].permType"
:
"
${update_macro_perm_type}"
}
-
not_in
:
{
"
$.data.brandList[*].macroId"
:
"
${append_macro_id}"
}
api8
:
title
:
删除快捷回复
url
:
/api/v1/macro/del
method
:
post
data
:
{
"
macro_id"
:
"
${append_macro_id}"
,
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api9
:
title
:
检查快捷回复是否删除成功 - 设置页快捷回复列表
url
:
/api/v1/macro/getAllList?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
not_in
:
{
"
$.data.brandList[*].macroId"
:
"
${append_macro_id}"
}
-
not_in
:
{
"
$.data.userList[*].macroId"
:
"
${append_macro_id}"
}
-
not_in
:
{
"
$.data.teamList[*].macroId"
:
"
${append_macro_id}"
}
api10
:
title
:
检查快捷回复是否删除成功 - inbox页快捷回复列表
url
:
/api/v1/macro/getList?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
not_in
:
{
"
$.data.brandList[*].macroId"
:
"
${append_macro_id}"
}
-
not_in
:
{
"
$.data.userList[*].macroId"
:
"
${append_macro_id}"
}
-
not_in
:
{
"
$.data.teamList[*].macroId"
:
"
${append_macro_id}"
}
YamlCase/setting/survey.yaml
0 → 100644
View file @
d8b3345b
api1
:
title
:
关闭评分推送
url
:
/api/v1/setting/updateShopSetting
method
:
post
data
:
{
"
item"
:[{
"
shopId"
:
"
0"
,
"
itemId"
:
76
,
"
itemValue"
:
"
false"
,
"
itemName"
:
"
askSendReview"
}],
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api2
:
title
:
检查评分推送是否关闭
url
:
/api/v1/setting/getShopSetting?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.0.settings[?(@.itemId
==
76)].itemValue"
:
"
false"
}
api3
:
title
:
开启评分推送
url
:
/api/v1/setting/updateShopSetting
method
:
post
data
:
{
"
item"
:[{
"
shopId"
:
"
0"
,
"
itemId"
:
76
,
"
itemValue"
:
"
true"
,
"
itemName"
:
"
askSendReview"
}],
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api4
:
title
:
检查评分推送是否开启
url
:
/api/v1/setting/getShopSetting?v=${v}
method
:
get
set_value
:
{
"
origin_survey_content"
:
"
$.data.settingInfoMap.mapList.${shopId}.settings[?(@.itemId
==
78)].itemValue"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.0.settings[?(@.itemId
==
76)].itemValue"
:
"
true"
}
api5
:
title
:
更新评分推送里的文案、评分样式
url
:
/api/v1/setting/updateShopSetting
method
:
post
data
:
{
"
item"
:[{
"
shopId"
:
"
${shopId}"
,
"
itemId"
:
78
,
"
itemValue"
:
"
${survey_content}"
,
"
itemName"
:
"
reviewContent"
},{
"
shopId"
:
"
${shopId}"
,
"
itemId"
:
81
,
"
itemValue"
:
"
star"
,
"
itemName"
:
"
reviewChoose"
}],
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api6
:
title
:
检查更新是否生效
url
:
/api/v1/setting/getShopSetting?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.${shopId}.settings[?(@.itemId
==
78)].itemValue"
:
"
${survey_content}"
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.${shopId}.settings[?(@.itemId
==
81)].itemValue"
:
"
star"
}
api7
:
title
:
还原评分推送里的文案、评分样式
url
:
/api/v1/setting/updateShopSetting
method
:
post
data
:
{
"
item"
:[{
"
shopId"
:
"
${shopId}"
,
"
itemId"
:
78
,
"
itemValue"
:
"
${origin_survey_content}"
,
"
itemName"
:
"
reviewContent"
},{
"
shopId"
:
"
${shopId}"
,
"
itemId"
:
81
,
"
itemValue"
:
"
thumbs"
,
"
itemName"
:
"
reviewChoose"
}],
"
v"
:
"
${v}"
}
expected
:
-
eq
:
{
"
$.code"
:
0
}
api8
:
title
:
检查还原是否生效
url
:
/api/v1/setting/getShopSetting?v=${v}
method
:
get
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.${shopId}.settings[?(@.itemId
==
78)].itemValue"
:
"
${origin_survey_content}"
}
-
eq
:
{
"
$.data.settingInfoMap.mapList.${shopId}.settings[?(@.itemId
==
81)].itemValue"
:
"
thumbs"
}
\ 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