Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
API-Automation
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
文鑫
API-Automation
Commits
9ba8ec8b
Commit
9ba8ec8b
authored
Jul 06, 2020
by
文鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加获取用例severity的方法
parent
1251b0e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
common/getData.py
+4
-3
common/getSourceId.py
+6
-7
data/DataA_Source.xlsx
+0
-0
No files found.
common/getData.py
View file @
9ba8ec8b
...
...
@@ -17,9 +17,10 @@ class DoExcelByPandas(object):
test_data
=
[]
# 获取行号索引,并对其进行遍历
for
i
in
df
.
index
.
values
:
# 根据i获取该行的数据,并通过to_dict转化成字典 -- 这里不能用iloc, iloc只能用数字索引
row_data
=
df
.
loc
[
i
,
[
'
id'
,
'url'
,
'data'
,
'story'
,
'
severity'
]]
.
to_dict
()
# 根据i获取该行的数据,
通过[]指定需要获取的字段,
并通过to_dict转化成字典 -- 这里不能用iloc, iloc只能用数字索引
row_data
=
df
.
loc
[
i
,
[
'severity'
]]
.
to_dict
()
test_data
.
append
(
row_data
)
return
test_data
for
i
in
test_data
:
#遍历字典,并取出severity的值
return
i
[
'severity'
]
common/getSourceId.py
View file @
9ba8ec8b
...
...
@@ -4,15 +4,14 @@ import re
def
get_SourceId
(
sourceName
):
response
=
requests
.
get
(
'http://10.197.236.159:8014/web/data-source/base/find-pools'
)
data
=
response
.
json
()[
'data'
]
text
=
''
for
i
in
data
:
if
i
[
'dataSourceName'
]
==
sourceName
:
data
=
response
.
json
()[
'data'
]
#访问获取数据源的接口,并取出其中的data内容
text
=
''
#定义一个字符串
for
i
in
data
:
#遍历data内容(list)
if
i
[
'dataSourceName'
]
==
sourceName
:
#将sourceName等于传入参数的内容取出
# print(i)
text
=
i
pattern
=
re
.
compile
(
"'dataSourceId': '(
\
d+)'"
)
pattern
=
re
.
compile
(
"'dataSourceId': '(
\
d+)'"
)
#使用正则匹配的方式,获取其中的sourceID
id
=
''
.
join
(
pattern
.
findall
(
str
(
text
)))
return
id
# print(id)
# print('http://10.197.236.159:8014/web/data-source/base/remove/'+id)
data/DataA_Source.xlsx
View file @
9ba8ec8b
No preview for this file type
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