Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zmops-test
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sanshi
zmops-test
Commits
915dc070
Commit
915dc070
authored
Dec 03, 2019
by
sanshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除资产
parent
88847c35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
test_device_delete.py
WorkCase/APP/Device/test_device_delete.py
+16
-0
__init__.py
WorkCase/__init__.py
+2
-1
No files found.
WorkCase/APP/Device/test_device_delete.py
View file @
915dc070
...
...
@@ -17,6 +17,7 @@ from WorkApi.APP.Device.device_delete import DeviceDelete
from
WorkData.Argus.members
import
DataMembers
from
WorkData.Argus.hosts
import
DataHosts
from
WorkData.Zabbix.hosts
import
DataHosts
as
DataHostsZabbix
from
WorkData.Argus.alarm_rule
import
DataAlarmRule
import
allure
...
...
@@ -32,6 +33,7 @@ class TestDeviceDelete(object):
db_user
=
env
[
"db_user"
]
db_pw
=
env
[
"db_pw"
]
db_base
=
env
[
"db_base"
]
db_base_zabbix
=
env
[
"db_base"
]
login_name
=
"SS测试用户名"
base_id
=
10
...
...
@@ -136,12 +138,23 @@ class TestDeviceDelete(object):
session
=
UtilsDataBase
()
.
conn_mysql
(
db_url
=
self
.
db_url
,
db_port
=
self
.
db_port
,
db_base
=
self
.
db_base
,
db_user
=
self
.
db_user
,
db_pw
=
self
.
db_pw
)
return
session
@allure.step
(
"连接数据库:Zabbix"
)
def
db_session_zabbix
(
self
):
session
=
UtilsDataBase
()
.
conn_mysql
(
db_url
=
self
.
db_url
,
db_port
=
self
.
db_port
,
db_base
=
self
.
db_base_zabbix
,
db_user
=
self
.
db_user
,
db_pw
=
self
.
db_pw
)
return
session
@allure.step
(
"查询表:hosts"
)
def
select_hosts
(
self
,
hostid
=
None
,
host_name
=
None
,
available
=
None
,
monitor_status
=
None
):
session
=
self
.
db_session
()
sql
=
DataHosts
()
.
select_all_from_allKeys
(
session
=
session
,
hostid
=
hostid
,
host_name
=
host_name
,
available
=
available
,
monitor_status
=
monitor_status
)
return
sql
@allure.step
(
"查询表:hosts"
)
def
select_hosts_zabbix
(
self
,
hostid
=
None
):
session
=
self
.
db_session
()
sql
=
DataHostsZabbix
()
.
select_all_from_allKeys
(
session
=
session
,
hostid
=
hostid
)
return
sql
@allure.step
(
"校验查询结果"
)
def
check_select
(
self
):
sql
=
self
.
select_hosts
(
hostid
=
self
.
device_id
)
...
...
@@ -149,6 +162,9 @@ class TestDeviceDelete(object):
assert
y
.
del_flag
==
1
assert
x
==
0
sql
=
self
.
select_hosts_zabbix
(
hostid
=
self
.
device_id
)
assert
sql
==
[]
@allure.step
(
"断言返回结果"
)
def
check_code
(
self
,
response
,
code
):
_code
=
UtilsResponse
()
.
get_code
(
response
=
response
)
...
...
WorkCase/__init__.py
View file @
915dc070
...
...
@@ -28,7 +28,8 @@ class CaseBase:
"db_port"
:
3306
,
"db_user"
:
"root"
,
"db_pw"
:
"123456"
,
"db_base"
:
"argus"
"db_base"
:
"argus"
,
"db_base_zabbix"
:
"zabbix"
}
self
.
app_environment_host
=
{
...
...
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