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
327aed39
Commit
327aed39
authored
May 22, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用例
parent
dcca9481
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
1 deletion
+179
-1
TestFile/automation/rule/rule_object_select.py
TestFile/automation/rule/rule_object_select.py
+30
-0
TestFile/automation/workflow/workflow_object_select.py
TestFile/automation/workflow/workflow_object_select.py
+90
-0
YamlCase/automation/rule.yaml
YamlCase/automation/rule.yaml
+20
-1
YamlCase/automation/workflow.yaml
YamlCase/automation/workflow.yaml
+39
-0
No files found.
TestFile/automation/rule/rule_object_select.py
0 → 100644
View file @
327aed39
from
Utils.sql_handler
import
test_env_conn
from
TestData.automation.rule_test_data
import
ruleData
rule_object_select_sql
=
f
'select * from `rule_object` where tpl_id = "
{
ruleData
.
rule_parent_template_id
}
" and status = 1 '
rule_object_select_result
=
test_env_conn
.
select_many_value
(
sql
=
rule_object_select_sql
)
rule_num
=
len
(
rule_object_select_result
)
rule
=
rule_object_select_result
[
0
]
rule_name
=
rule
[
'obj_name'
]
rule_describe
=
rule
[
'obj_describe'
]
rule_type
=
rule
[
'obj_type'
]
rule_category
=
rule
[
'obj_category'
]
rule_id
=
rule
[
'rob_id'
]
rule_value_from
=
rule
[
'value_from'
]
rule_show_type
=
rule
[
'show_type'
]
rule_show_kind
=
rule
[
'show_kind'
]
rule_kind
=
rule
[
'obj_kind'
]
rule_parent_rob_id
=
rule
[
'parent_rob_id'
]
setattr
(
ruleData
,
'rule_name'
,
rule_name
)
setattr
(
ruleData
,
'rule_describe'
,
rule_describe
)
setattr
(
ruleData
,
'rule_type'
,
rule_type
)
setattr
(
ruleData
,
'rule_category'
,
rule_category
)
setattr
(
ruleData
,
'rule_id'
,
rule_id
)
setattr
(
ruleData
,
'rule_value_from'
,
rule_value_from
)
setattr
(
ruleData
,
'rule_show_type'
,
rule_show_type
)
setattr
(
ruleData
,
'rule_show_kind'
,
rule_show_kind
)
setattr
(
ruleData
,
'rule_kind'
,
rule_kind
)
setattr
(
ruleData
,
'rule_parent_rob_id'
,
rule_parent_rob_id
)
setattr
(
ruleData
,
'rule_num'
,
rule_num
)
TestFile/automation/workflow/workflow_object_select.py
0 → 100644
View file @
327aed39
from
Utils.sql_handler
import
test_env_conn
from
TestData.automation.workflow_test_data
import
workflowData
workflow_object_select_sql
=
f
'select * from `rule_object` where tpl_id = "
{
workflowData
.
workflow_parent_template_id
}
" and status = 1'
workflow_object_select_result
=
test_env_conn
.
select_many_value
(
sql
=
workflow_object_select_sql
)
condition_object_list
=
[]
result_object_list
=
[]
event_object_list
=
[]
for
object
in
workflow_object_select_result
:
if
object
[
'obj_kind'
]
==
1
:
condition_object_list
.
append
(
object
)
elif
object
[
'obj_kind'
]
==
2
:
result_object_list
.
append
(
object
)
elif
object
[
'obj_kind'
]
==
3
:
event_object_list
.
append
(
object
)
condition_num
=
len
(
condition_object_list
)
result_num
=
len
(
result_object_list
)
event_num
=
len
(
event_object_list
)
condition
=
condition_object_list
[
0
]
result
=
result_object_list
[
0
]
event
=
event_object_list
[
0
]
condition_name
=
condition
[
'obj_name'
]
condition_describe
=
condition
[
'obj_describe'
]
condition_type
=
condition
[
'obj_type'
]
condition_category
=
condition
[
'obj_category'
]
condition_id
=
condition
[
'rob_id'
]
condition_value_from
=
condition
[
'value_from'
]
condition_show_type
=
condition
[
'show_type'
]
condition_show_kind
=
condition
[
'show_kind'
]
condition_kind
=
condition
[
'obj_kind'
]
condition_parent_rob_id
=
condition
[
'parent_rob_id'
]
result_name
=
result
[
'obj_name'
]
result_describe
=
result
[
'obj_describe'
]
result_type
=
result
[
'obj_type'
]
result_category
=
result
[
'obj_category'
]
result_id
=
result
[
'rob_id'
]
result_value_from
=
result
[
'value_from'
]
result_show_type
=
result
[
'show_type'
]
result_show_kind
=
result
[
'show_kind'
]
result_kind
=
result
[
'obj_kind'
]
result_parent_rob_id
=
result
[
'parent_rob_id'
]
event_name
=
event
[
'obj_name'
]
event_describe
=
event
[
'obj_describe'
]
event_type
=
event
[
'obj_type'
]
event_category
=
event
[
'obj_category'
]
event_id
=
event
[
'rob_id'
]
event_value_from
=
event
[
'value_from'
]
event_show_type
=
event
[
'show_type'
]
event_show_kind
=
event
[
'show_kind'
]
event_kind
=
event
[
'obj_kind'
]
event_parent_rob_id
=
event
[
'parent_rob_id'
]
setattr
(
workflowData
,
'condition_name'
,
condition_name
)
setattr
(
workflowData
,
'condition_describe'
,
condition_describe
)
setattr
(
workflowData
,
'condition_type'
,
condition_type
)
setattr
(
workflowData
,
'condition_category'
,
condition_category
)
setattr
(
workflowData
,
'condition_id'
,
condition_id
)
setattr
(
workflowData
,
'condition_value_from'
,
condition_value_from
)
setattr
(
workflowData
,
'condition_show_type'
,
condition_show_type
)
setattr
(
workflowData
,
'condition_show_kind'
,
condition_show_kind
)
setattr
(
workflowData
,
'condition_parent_rob_id'
,
condition_parent_rob_id
)
setattr
(
workflowData
,
'result_name'
,
result_name
)
setattr
(
workflowData
,
'result_describe'
,
result_describe
)
setattr
(
workflowData
,
'result_type'
,
result_type
)
setattr
(
workflowData
,
'result_category'
,
result_category
)
setattr
(
workflowData
,
'result_id'
,
result_id
)
setattr
(
workflowData
,
'result_value_from'
,
result_value_from
)
setattr
(
workflowData
,
'result_show_type'
,
result_show_type
)
setattr
(
workflowData
,
'result_show_kind'
,
result_show_kind
)
setattr
(
workflowData
,
'result_parent_rob_id'
,
result_parent_rob_id
)
setattr
(
workflowData
,
'event_name'
,
event_name
)
setattr
(
workflowData
,
'event_describe'
,
event_describe
)
setattr
(
workflowData
,
'event_type'
,
event_type
)
setattr
(
workflowData
,
'event_category'
,
event_category
)
setattr
(
workflowData
,
'event_id'
,
event_id
)
setattr
(
workflowData
,
'event_value_from'
,
event_value_from
)
setattr
(
workflowData
,
'event_show_type'
,
event_show_type
)
setattr
(
workflowData
,
'event_show_kind'
,
event_show_kind
)
setattr
(
workflowData
,
'event_parent_rob_id'
,
event_parent_rob_id
)
setattr
(
workflowData
,
'condition_kind'
,
condition_kind
)
setattr
(
workflowData
,
'result_kind'
,
result_kind
)
setattr
(
workflowData
,
'event_kind'
,
event_kind
)
setattr
(
workflowData
,
'condition_num'
,
condition_num
)
setattr
(
workflowData
,
'result_num'
,
result_num
)
setattr
(
workflowData
,
'event_num'
,
event_num
)
YamlCase/automation/rule.yaml
View file @
327aed39
...
@@ -121,4 +121,23 @@ api14:
...
@@ -121,4 +121,23 @@ api14:
method
:
post
method
:
post
data
:
{
"
uid"
:
"
${userId}"
,
"
uType"
:
2
,
"
platform"
:
1
,
"
roomId"
:
"
${roomId}"
,
"
clientId"
:
"
${willdesk_clientId}"
,
"
event"
:
"
open"
,
"
username"
:
"
${name}"
,
"
isMark"
:
false
,
"
allocationUid"
:
"
${userId}"
,
"
v"
:
"
${v}"
}
data
:
{
"
uid"
:
"
${userId}"
,
"
uType"
:
2
,
"
platform"
:
1
,
"
roomId"
:
"
${roomId}"
,
"
clientId"
:
"
${willdesk_clientId}"
,
"
event"
:
"
open"
,
"
username"
:
"
${name}"
,
"
isMark"
:
false
,
"
allocationUid"
:
"
${userId}"
,
"
v"
:
"
${v}"
}
expected
:
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.code"
:
0
}
\ No newline at end of file
api15
:
title
:
检查rule的object
url
:
/api/v1/rule/ruleTemplate
method
:
post
data
:
{
"
tplId"
:
"
${rule_parent_template_id}"
,
"
v"
:
"
${v}"
}
before_sql
:
automation/rule/rule_object_select.py
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].objName"
:
"
${rule_name}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].objDescribe"
:
"
${rule_describe}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].objKind"
:
"
${rule_kind}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].objType"
:
"
${rule_type}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].objCategory"
:
"
${rule_category}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].parentRobId"
:
"
${rule_parent_rob_id}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].showKind"
:
"
${rule_show_kind}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].showType"
:
"
${rule_show_type}"
}
-
eq
:
{
"
$.data.objList[?(@.robId
==
'${rule_id}')].valueFrom"
:
"
${rule_value_from}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['objList'])
==
${rule_num}"
}
\ No newline at end of file
YamlCase/automation/workflow.yaml
View file @
327aed39
...
@@ -109,3 +109,42 @@ api12:
...
@@ -109,3 +109,42 @@ api12:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.total"
:
"
${workflow_num_less}"
}
-
eq
:
{
"
$.data.total"
:
"
${workflow_num_less}"
}
-
not_in_list
:
{
"
$.data.ruleList[*].ruleId"
:
"
${create_workflow_id}"
}
-
not_in_list
:
{
"
$.data.ruleList[*].ruleId"
:
"
${create_workflow_id}"
}
api13
:
title
:
workflow的object检查
url
:
/api/v1/rule/ruleObjects
method
:
post
data
:
{
"
tplId"
:
"
${workflow_parent_template_id}"
,
"
v"
:
"
${v}"
}
before_sql
:
automation/workflow/workflow_object_select.py
expected
:
-
eq
:
{
"
$.code"
:
0
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].objName"
:
"
${condition_name}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].objDescribe"
:
"
${condition_describe}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].objCategory"
:
"
${condition_category}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].objKind"
:
"
${condition_kind}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].objType"
:
"
${condition_type}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].parentRobId"
:
"
${condition_parent_rob_id}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].showKind"
:
"
${condition_show_kind}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].showType"
:
"
${condition_show_type}"
}
-
eq
:
{
"
$.data.conditionObjList[?(@.robId
==
'${condition_id}')].valueFrom"
:
"
${condition_value_from}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['conditionObjList'])
==
${condition_num}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].objName"
:
"
${result_name}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].objDescribe"
:
"
${result_describe}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].objCategory"
:
"
${result_category}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].objKind"
:
"
${result_kind}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].objType"
:
"
${result_type}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].parentRobId"
:
"
${result_parent_rob_id}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].showKind"
:
"
${result_show_kind}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].showType"
:
"
${result_show_type}"
}
-
eq
:
{
"
$.data.resultObjList[?(@.robId
==
'${result_id}')].valueFrom"
:
"
${result_value_from}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['resultObjList'])
==
${result_num}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].objName"
:
"
${event_name}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].objDescribe"
:
"
${event_describe}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].objCategory"
:
"
${event_category}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].objKind"
:
"
${event_kind}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].objType"
:
"
${event_type}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].parentRobId"
:
"
${event_parent_rob_id}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].showKind"
:
"
${event_show_kind}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].showType"
:
"
${event_show_type}"
}
-
eq
:
{
"
$.data.eventObjList[?(@.robId
==
'${event_id}')].valueFrom"
:
"
${event_value_from}"
}
-
exec
:
{
"
code"
:
"
assert
len(res.json()['data']['eventObjList'])
==
${event_num}"
}
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