Commit 915dc070 by sanshi

删除资产

parent 88847c35
......@@ -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)
......
......@@ -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 = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment