Commit f54833e8 by sanshi

token 調整

parent 7bb5746c
...@@ -120,7 +120,7 @@ class TestAddressBookIplistGet(object): ...@@ -120,7 +120,7 @@ class TestAddressBookIplistGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_iplist_get() response = self.app.addressbook_iplist_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.iplist.get:token的用户已删除") @allure.title("addressbook.iplist.get:token的用户已删除")
@allure.story("查询地址簿列表:token的用户已删除") @allure.story("查询地址簿列表:token的用户已删除")
......
...@@ -45,9 +45,9 @@ class TestAddressBookCreate(object): ...@@ -45,9 +45,9 @@ class TestAddressBookCreate(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.0.1-254" base_iplist = "172.16.3.1-254"
base_iprange = "192.168.0.1-254" base_iprange = "172.16.3.1-254"
base_delay = "1h" base_delay = "1h"
@classmethod @classmethod
...@@ -152,7 +152,7 @@ class TestAddressBookCreate(object): ...@@ -152,7 +152,7 @@ class TestAddressBookCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_create() response = self.app.addressbook_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.create:token的用户已删除") @allure.title("addressbook.create:token的用户已删除")
@allure.story("创建地址簿:token的用户已删除") @allure.story("创建地址簿:token的用户已删除")
...@@ -190,7 +190,7 @@ class TestAddressBookCreate(object): ...@@ -190,7 +190,7 @@ class TestAddressBookCreate(object):
def test_case_05(self): def test_case_05(self):
name = self.base_name + "05" name = self.base_name + "05"
response = self.app.addressbook_create(token=self.token, name=name, iplist=self.base_iplist, response = self.app.addressbook_create(token=self.token, name=name, iplist=self.base_iplist,
available=CaseBase().available["ON"], delay="1h", _type=2) available=CaseBase().available["ON"], delay="1m", _type=2)
self.app.check_code(response=response, code=0) self.app.check_code(response=response, code=0)
self.check_select(response=response, name=name, available=CaseBase().available["ON"], check_type=2, self.check_select(response=response, name=name, available=CaseBase().available["ON"], check_type=2,
dchecks_type=11, dchecks_key_="1.3.6.1.2.1.25.4.2.1.2", dchecks_snmp_community="{$SNMP_COMMUNITY}", dchecks_type=11, dchecks_key_="1.3.6.1.2.1.25.4.2.1.2", dchecks_snmp_community="{$SNMP_COMMUNITY}",
...@@ -228,13 +228,13 @@ if __name__ == "__main__": ...@@ -228,13 +228,13 @@ if __name__ == "__main__":
import os import os
# 执行自动化测试用例 # 执行自动化测试用例
case_info = os.path.split(__file__) # case_info = os.path.split(__file__)
case = UtilsCmd().pytest_cmd() # case = UtilsCmd().pytest_cmd()
r = UtilsPyTest(case=case, case_info=case_info) # r = UtilsPyTest(case=case, case_info=case_info)
r.run_main() # r.run_main()
# a = TestAddressBookCreate() a = TestAddressBookCreate()
# a.setup_class() a.setup_class()
# a.setup_method() a.setup_method()
# a.test_case_04() a.test_case_05()
...@@ -45,7 +45,7 @@ class TestAddressBookDelete(object): ...@@ -45,7 +45,7 @@ class TestAddressBookDelete(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.1.1-254" base_iplist = "172.16.3.1-254"
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
...@@ -112,7 +112,7 @@ class TestAddressBookDelete(object): ...@@ -112,7 +112,7 @@ class TestAddressBookDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_delete() response = self.app.addressbook_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.delete:token的用户已删除") @allure.title("addressbook.delete:token的用户已删除")
@allure.story("删除地址簿:token的用户已删除") @allure.story("删除地址簿:token的用户已删除")
......
...@@ -45,7 +45,7 @@ class TestAddressBookDisabled(object): ...@@ -45,7 +45,7 @@ class TestAddressBookDisabled(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.6.1-254" base_iplist = "172.16.3.1-254"
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
...@@ -122,7 +122,7 @@ class TestAddressBookDisabled(object): ...@@ -122,7 +122,7 @@ class TestAddressBookDisabled(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_disabled() response = self.app.addressbook_disabled()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.disabled:token的用户已删除") @allure.title("addressbook.disabled:token的用户已删除")
@allure.story("禁用地址簿:token的用户已删除") @allure.story("禁用地址簿:token的用户已删除")
......
...@@ -45,7 +45,7 @@ class TestAddressBookEnable(object): ...@@ -45,7 +45,7 @@ class TestAddressBookEnable(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.5.1-254" base_iplist = "172.16.3.1-254"
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
...@@ -122,7 +122,7 @@ class TestAddressBookEnable(object): ...@@ -122,7 +122,7 @@ class TestAddressBookEnable(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_enabled() response = self.app.addressbook_enabled()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.enabled:token的用户已删除") @allure.title("addressbook.enabled:token的用户已删除")
@allure.story("启用地址簿:token的用户已删除") @allure.story("启用地址簿:token的用户已删除")
......
...@@ -45,7 +45,7 @@ class TestAddressBookGet(object): ...@@ -45,7 +45,7 @@ class TestAddressBookGet(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.5.1-254" base_iplist = "172.16.3.1-254"
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
...@@ -124,7 +124,7 @@ class TestAddressBookGet(object): ...@@ -124,7 +124,7 @@ class TestAddressBookGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_get() response = self.app.addressbook_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.get:token的用户已删除") @allure.title("addressbook.get:token的用户已删除")
@allure.story("查询地址簿:token的用户已删除") @allure.story("查询地址簿:token的用户已删除")
......
...@@ -46,8 +46,8 @@ class TestAddressBookUpdate(object): ...@@ -46,8 +46,8 @@ class TestAddressBookUpdate(object):
base_password = "123456" base_password = "123456"
base_name = "SS 自动化专用地址簿" base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.3.1-254" base_iplist = "172.16.3.1-254"
base_update_iplist = "192.168.4.1-254" base_update_iplist = "172.16.3.2-254"
base_iprange = "192.168.0.1-254" base_iprange = "192.168.0.1-254"
base_delay = "1h" base_delay = "1h"
...@@ -154,7 +154,7 @@ class TestAddressBookUpdate(object): ...@@ -154,7 +154,7 @@ class TestAddressBookUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.addressbook_update() response = self.app.addressbook_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("addressbook.update:token的用户已删除") @allure.title("addressbook.update:token的用户已删除")
@allure.story("更新地址簿:token的用户已删除") @allure.story("更新地址簿:token的用户已删除")
......
...@@ -96,7 +96,7 @@ class TestBusinessesCreate(object): ...@@ -96,7 +96,7 @@ class TestBusinessesCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_create() response = self.app.businesses_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.create:token的用户已删除") @allure.title("businesses.create:token的用户已删除")
@allure.story("创建业务:token的用户已删除") @allure.story("创建业务:token的用户已删除")
......
...@@ -87,7 +87,7 @@ class TestBusinessesDelete(object): ...@@ -87,7 +87,7 @@ class TestBusinessesDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_delete() response = self.app.businesses_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.delete:token的用户已删除") @allure.title("businesses.delete:token的用户已删除")
@allure.story("删除业务:token的用户已删除") @allure.story("删除业务:token的用户已删除")
......
...@@ -108,7 +108,7 @@ class TestBusinessesGet(object): ...@@ -108,7 +108,7 @@ class TestBusinessesGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_get() response = self.app.businesses_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.get:token的用户已删除") @allure.title("businesses.get:token的用户已删除")
@allure.story("查询业务:token的用户已删除") @allure.story("查询业务:token的用户已删除")
......
...@@ -109,7 +109,7 @@ class TestBusinessesTree(object): ...@@ -109,7 +109,7 @@ class TestBusinessesTree(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_tree() response = self.app.businesses_tree()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.tree:token的用户已删除") @allure.title("businesses.tree:token的用户已删除")
@allure.story("查询业务:token的用户已删除") @allure.story("查询业务:token的用户已删除")
......
...@@ -87,7 +87,7 @@ class TestBusinessesTypeCreate(object): ...@@ -87,7 +87,7 @@ class TestBusinessesTypeCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_type_create() response = self.app.businesses_type_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.type.create:token的用户已删除") @allure.title("businesses.type.create:token的用户已删除")
@allure.story("创建业务类型:token的用户已删除") @allure.story("创建业务类型:token的用户已删除")
......
...@@ -80,7 +80,7 @@ class TestBusinessesTypeDelete(object): ...@@ -80,7 +80,7 @@ class TestBusinessesTypeDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_type_delete() response = self.app.businesses_type_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.type.delete:token的用户已删除") @allure.title("businesses.type.delete:token的用户已删除")
@allure.story("删除业务类型:token的用户已删除") @allure.story("删除业务类型:token的用户已删除")
......
...@@ -89,7 +89,7 @@ class TestBusinessesTypeGet(object): ...@@ -89,7 +89,7 @@ class TestBusinessesTypeGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_type_get() response = self.app.businesses_type_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.type.get:token的用户已删除") @allure.title("businesses.type.get:token的用户已删除")
@allure.story("查询业务类型:token的用户已删除") @allure.story("查询业务类型:token的用户已删除")
......
...@@ -88,7 +88,7 @@ class TestBusinessesTypeUpdate(object): ...@@ -88,7 +88,7 @@ class TestBusinessesTypeUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_type_update() response = self.app.businesses_type_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.type.update:token的用户已删除") @allure.title("businesses.type.update:token的用户已删除")
@allure.story("更新业务类型:token的用户已删除") @allure.story("更新业务类型:token的用户已删除")
......
...@@ -104,7 +104,7 @@ class TestBusinessesUpdate(object): ...@@ -104,7 +104,7 @@ class TestBusinessesUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.businesses_update() response = self.app.businesses_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("businesses.update:token的用户已删除") @allure.title("businesses.update:token的用户已删除")
@allure.story("更新业务:token的用户已删除") @allure.story("更新业务:token的用户已删除")
......
...@@ -91,7 +91,7 @@ class TestDeviceAssetGetFactoryList(object): ...@@ -91,7 +91,7 @@ class TestDeviceAssetGetFactoryList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_asset_getFactoryList() response = self.app.device_asset_getFactoryList()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.asset.getFactoryList:token的用户已删除") @allure.title("device.asset.getFactoryList:token的用户已删除")
@allure.story("查询品牌下拉框:token的用户已删除") @allure.story("查询品牌下拉框:token的用户已删除")
......
...@@ -102,7 +102,7 @@ class TestDeviceAssetIps(object): ...@@ -102,7 +102,7 @@ class TestDeviceAssetIps(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_asset_ips() response = self.app.device_asset_ips()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.asset.ips:token的用户已删除") @allure.title("device.asset.ips:token的用户已删除")
@allure.story("查询资产IPS下拉框:token的用户已删除") @allure.story("查询资产IPS下拉框:token的用户已删除")
......
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
from __future__ import division from __future__ import division
from WorkCase import CaseBase from WorkCase import CaseBase
from WorkData.Zabbix.items import DataItems
from WorkUtils.UtilsLog import UtilsLog from WorkUtils.UtilsLog import UtilsLog
from WorkUtils.UtilsDataBase import UtilsDataBase from WorkUtils.UtilsDataBase import UtilsDataBase
from WorkUtils.UtilsResponse import UtilsResponse from WorkUtils.UtilsResponse import UtilsResponse
from WorkData.Argus.hosts import DataHosts from WorkData.Argus.hosts import DataHosts
from WorkData.Argus.businesses_hosts import DataBusinessesHosts
from WorkData.Zabbix.hosts import DataHosts as ZabbixDataHosts
from WorkData.Zabbix.interface import DataInterface from WorkData.Zabbix.interface import DataInterface
import allure import allure
...@@ -28,6 +32,12 @@ class TestDeviceCreate(object): ...@@ -28,6 +32,12 @@ class TestDeviceCreate(object):
db_user = env["db_user"] db_user = env["db_user"]
db_pw = env["db_pw"] db_pw = env["db_pw"]
db_base = env["db_base"] db_base = env["db_base"]
host_zabbix = env["host_zabbix"]
db_url_zabbix = env["db_url_zabbix"]
db_port_zabbix = env["db_port_zabbix"]
db_user_zabbix = env["db_user_zabbix"]
db_pw_zabbix = env["db_pw_zabbix"]
db_base_zabbix = env["db_base_zabbix"] db_base_zabbix = env["db_base_zabbix"]
login_name = "SS测试用户名" login_name = "SS测试用户名"
...@@ -41,8 +51,8 @@ class TestDeviceCreate(object): ...@@ -41,8 +51,8 @@ class TestDeviceCreate(object):
base_port = 161 base_port = 161
base_name = "SS 自动化专用" base_name = "SS 自动化专用"
base_business_id_1 = "12" base_business_id_1 = 12
base_business_id_2 = "13" base_business_id_2 = 13
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
...@@ -50,6 +60,19 @@ class TestDeviceCreate(object): ...@@ -50,6 +60,19 @@ class TestDeviceCreate(object):
session = UtilsDataBase().conn_mysql(db_url=cls.db_url, db_port=cls.db_port, db_base=cls.db_base, db_user=cls.db_user, db_pw=cls.db_pw) session = UtilsDataBase().conn_mysql(db_url=cls.db_url, db_port=cls.db_port, db_base=cls.db_base, db_user=cls.db_user, db_pw=cls.db_pw)
DataHosts().delete_like_host_name(session=session, host_name=cls.base_name) DataHosts().delete_like_host_name(session=session, host_name=cls.base_name)
session = UtilsDataBase().conn_mysql(db_url=cls.db_url_zabbix, db_port=cls.db_port_zabbix, db_base=cls.db_base_zabbix,
db_user=cls.db_user_zabbix, db_pw=cls.db_pw_zabbix)
sql = ZabbixDataHosts().select_like_name(session=session, name=cls.base_name)
for x, y in enumerate(sql):
session = UtilsDataBase().conn_mysql(db_url=cls.db_url_zabbix, db_port=cls.db_port_zabbix, db_base=cls.db_base_zabbix,
db_user=cls.db_user_zabbix, db_pw=cls.db_pw_zabbix)
DataItems().delete_hostid(session=session, hostid=y.hostid)
session = UtilsDataBase().conn_mysql(db_url=cls.db_url_zabbix, db_port=cls.db_port_zabbix, db_base=cls.db_base_zabbix,
db_user=cls.db_user_zabbix, db_pw=cls.db_pw_zabbix)
ZabbixDataHosts().delete_like_name(session=session, name=cls.base_name)
@classmethod @classmethod
def teardown_class(cls): def teardown_class(cls):
cls.log.debug("结束执行测试套件.......") cls.log.debug("结束执行测试套件.......")
...@@ -74,7 +97,8 @@ class TestDeviceCreate(object): ...@@ -74,7 +97,8 @@ class TestDeviceCreate(object):
@allure.step("连接数据库:Zabbix") @allure.step("连接数据库:Zabbix")
def db_session_zabbix(self): 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) session = UtilsDataBase().conn_mysql(db_url=self.db_url_zabbix, db_port=self.db_port_zabbix,
db_base=self.db_base_zabbix, db_user=self.db_user_zabbix, db_pw=self.db_pw_zabbix)
return session return session
@allure.step("查询表:hosts") @allure.step("查询表:hosts")
...@@ -83,6 +107,12 @@ class TestDeviceCreate(object): ...@@ -83,6 +107,12 @@ class TestDeviceCreate(object):
sql = DataHosts().select_all_from_allKeys(session=session, hostid=hostid, host_name=host_name, available=available, monitor_status=monitor_status) sql = DataHosts().select_all_from_allKeys(session=session, hostid=hostid, host_name=host_name, available=available, monitor_status=monitor_status)
return sql return sql
@allure.step("查询表:businesses_hosts")
def select_businesses_hosts(self, hostid=None, businessesid=None):
session = self.db_session()
sql = DataBusinessesHosts().select_all_from_allKeys(session=session, hostid=hostid, businessesid=businessesid)
return sql
@allure.step("查询表:interface") @allure.step("查询表:interface")
def select_interface(self, hostid=None): def select_interface(self, hostid=None):
session = self.db_session_zabbix() session = self.db_session_zabbix()
...@@ -106,7 +136,7 @@ class TestDeviceCreate(object): ...@@ -106,7 +136,7 @@ class TestDeviceCreate(object):
def check_select(self, response, name, manage_ip, manage_level, host_type, parent_host, def check_select(self, response, name, manage_ip, manage_level, host_type, parent_host,
monitor_status, iplist, dns, monitor_interface, ops_person, factoryId, monitor_status, iplist, dns, monitor_interface, ops_person, factoryId,
model, version, serialnumber, description, snmp_community, ipmi_authtype, ipmi_privilege, model, version, serialnumber, description, snmp_community, ipmi_authtype, ipmi_privilege,
ipmi_username, ipmi_password, businessIds, hostTypeTree, businessTree): ipmi_username, ipmi_password, hostTypeTree, businessTree):
data = UtilsResponse().get_data(response=response) data = UtilsResponse().get_data(response=response)
sql = self.select_hosts(hostid=data) sql = self.select_hosts(hostid=data)
assert sql != [] assert sql != []
...@@ -123,7 +153,7 @@ class TestDeviceCreate(object): ...@@ -123,7 +153,7 @@ class TestDeviceCreate(object):
assert y.iplist == iplist assert y.iplist == iplist
assert y.dns == dns assert y.dns == dns
assert int(y.monitor_interface) == monitor_interface assert int(y.monitor_interface) == monitor_interface
assert y.business_ids == businessIds # assert y.business_ids == businessIds
assert y.host_type_tree == hostTypeTree assert y.host_type_tree == hostTypeTree
assert y.business_tree == businessTree assert y.business_tree == businessTree
# assert y.port == port # assert y.port == port
...@@ -140,6 +170,14 @@ class TestDeviceCreate(object): ...@@ -140,6 +170,14 @@ class TestDeviceCreate(object):
assert y.ipmi_password == ipmi_password assert y.ipmi_password == ipmi_password
assert x == 0 assert x == 0
sql = self.select_businesses_hosts(hostid=data)
business_ids = []
for x, y in enumerate(sql):
assert y.businessesid in [self.base_business_id_1, self.base_business_id_2]
business_ids.append(y.business_ids)
for x, y in enumerate([self.base_business_id_1, self.base_business_id_2]):
assert y in business_ids
@allure.step("校验查询结果") @allure.step("校验查询结果")
def check_monitor_type(self, response, name, monitor_type): def check_monitor_type(self, response, name, monitor_type):
data = UtilsResponse().get_data(response=response) data = UtilsResponse().get_data(response=response)
...@@ -155,7 +193,7 @@ class TestDeviceCreate(object): ...@@ -155,7 +193,7 @@ class TestDeviceCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_create() response = self.app.device_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.create:token的用户已删除") @allure.title("device.create:token的用户已删除")
@allure.story("创建资产:token的用户已删除") @allure.story("创建资产:token的用户已删除")
...@@ -234,19 +272,18 @@ class TestDeviceCreate(object): ...@@ -234,19 +272,18 @@ class TestDeviceCreate(object):
response = self.app.device_create(token=self.token, hostName=name, hostType=self.base_type_agent, response = self.app.device_create(token=self.token, hostName=name, hostType=self.base_type_agent,
iplist=self.base_ip, monitorInterface=self.base_port, iplist=self.base_ip, monitorInterface=self.base_port,
monitorType=1, manageLevel=1, parentHost=1, monitorType=1, manageLevel=1, parentHost=1,
businessIds=self.base_business_id_1 + "," + self.base_business_id_2, businessIds=[self.base_business_id_1, self.base_business_id_2],
hostTypeTree="hostTypeTree", hostTypeTree="hostTypeTree",
businessTree="businessTree", businessTree="businessTree",
opsPerson=11, snmpCommunity="snmpCommunity", opsPerson=11, snmpCommunity="public",
ipmiAuthtype=1, ipmiPrivilege=1, ipmiUsername="ipmiUsername", ipmiPassword="ipmiPassword", ipmiAuthtype=1, ipmiPrivilege=1, ipmiUsername="ipmiUsername", ipmiPassword="ipmiPassword",
factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description", factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description",
monitorStatus=1) monitorStatus=1)
self.app.check_code(response=response, code=0) self.app.check_code(response=response, code=0)
self.check_select(response=response, name=name, manage_ip=self.base_ip, manage_level=1, host_type=self.base_type_agent, monitor_status=1, self.check_select(response=response, name=name, manage_ip=self.base_ip, manage_level=1, host_type=self.base_type_agent, monitor_status=1,
iplist=self.base_ip, dns=None, monitor_interface=self.base_port, ops_person=11, snmp_community="snmpCommunity", iplist=self.base_ip, dns=None, monitor_interface=self.base_port, ops_person=11, snmp_community="public",
ipmi_authtype=1, ipmi_privilege=1, ipmi_username="ipmiUsername", ipmi_password="ipmiPassword", parent_host=1, ipmi_authtype=1, ipmi_privilege=1, ipmi_username="ipmiUsername", ipmi_password="ipmiPassword", parent_host=1,
factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description", factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description",
businessIds=self.base_business_id_1 + "," + self.base_business_id_2,
hostTypeTree="hostTypeTree", hostTypeTree="hostTypeTree",
businessTree="businessTree") businessTree="businessTree")
...@@ -258,12 +295,12 @@ if __name__ == "__main__": ...@@ -258,12 +295,12 @@ if __name__ == "__main__":
import os import os
# 执行自动化测试用例 # 执行自动化测试用例
case_info = os.path.split(__file__) # case_info = os.path.split(__file__)
case = UtilsCmd().pytest_cmd() # case = UtilsCmd().pytest_cmd()
r = UtilsPyTest(case=case, case_info=case_info) # r = UtilsPyTest(case=case, case_info=case_info)
r.run_main() # r.run_main()
# a = TestDeviceCreate() a = TestDeviceCreate()
# a.setup_class() a.setup_class()
# a.setup_method() a.setup_method()
# a.test_case_04() a.test_case_08()
...@@ -112,7 +112,7 @@ class TestDeviceDelete(object): ...@@ -112,7 +112,7 @@ class TestDeviceDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_delete() response = self.app.device_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.delete:token的用户已删除") @allure.title("device.delete:token的用户已删除")
@allure.story("删除资产:token的用户已删除") @allure.story("删除资产:token的用户已删除")
......
...@@ -90,7 +90,7 @@ class TestDeviceGet(object): ...@@ -90,7 +90,7 @@ class TestDeviceGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_get() response = self.app.device_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.get:token的用户已删除") @allure.title("device.get:token的用户已删除")
@allure.story("查询资产:token的用户已删除") @allure.story("查询资产:token的用户已删除")
......
...@@ -110,7 +110,7 @@ class TestDeviceStatus(object): ...@@ -110,7 +110,7 @@ class TestDeviceStatus(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_status() response = self.app.device_status()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.status:token的用户已删除") @allure.title("device.status:token的用户已删除")
@allure.story("变更状态:token的用户已删除") @allure.story("变更状态:token的用户已删除")
......
...@@ -165,7 +165,7 @@ class TestDeviceUpdate(object): ...@@ -165,7 +165,7 @@ class TestDeviceUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.device_update() response = self.app.device_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("device.update:token的用户已删除") @allure.title("device.update:token的用户已删除")
@allure.story("更新资产:token的用户已删除") @allure.story("更新资产:token的用户已删除")
......
...@@ -248,7 +248,7 @@ class TestExperienceCreate(object): ...@@ -248,7 +248,7 @@ class TestExperienceCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.experience_create() response = self.app.experience_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("experience.create:token的用户已删除") @allure.title("experience.create:token的用户已删除")
@allure.story("创建经验手册:token的用户已删除") @allure.story("创建经验手册:token的用户已删除")
......
...@@ -223,7 +223,7 @@ class TestExperienceDelete(object): ...@@ -223,7 +223,7 @@ class TestExperienceDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.experience_delete() response = self.app.experience_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("experience.delete:token的用户已删除") @allure.title("experience.delete:token的用户已删除")
@allure.story("删除经验手册:token的用户已删除") @allure.story("删除经验手册:token的用户已删除")
......
...@@ -96,7 +96,7 @@ class TestExperienceItemsList(object): ...@@ -96,7 +96,7 @@ class TestExperienceItemsList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.experience_items_list() response = self.app.experience_items_list()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("experience.items.list:token的用户已删除") @allure.title("experience.items.list:token的用户已删除")
@allure.story("查询监控项下拉框:token的用户已删除") @allure.story("查询监控项下拉框:token的用户已删除")
......
...@@ -152,7 +152,7 @@ class TestExperienceProblemList(object): ...@@ -152,7 +152,7 @@ class TestExperienceProblemList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.experience_problem_list() response = self.app.experience_problem_list()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("experience.problem.list:token的用户已删除") @allure.title("experience.problem.list:token的用户已删除")
@allure.story("查询告警下拉框:token的用户已删除") @allure.story("查询告警下拉框:token的用户已删除")
......
...@@ -304,7 +304,7 @@ class TestExperienceUpdate(object): ...@@ -304,7 +304,7 @@ class TestExperienceUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.experience_update() response = self.app.experience_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("experience.update:token的用户已删除") @allure.title("experience.update:token的用户已删除")
@allure.story("更新经验手册:token的用户已删除") @allure.story("更新经验手册:token的用户已删除")
......
...@@ -66,7 +66,7 @@ class TestFileUpload(object): ...@@ -66,7 +66,7 @@ class TestFileUpload(object):
def test_case_01(self): def test_case_01(self):
response = self.app.file_upload() response = self.app.file_upload()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("file.upload:token的用户已删除") @allure.title("file.upload:token的用户已删除")
@allure.story("文件上传:token的用户已删除") @allure.story("文件上传:token的用户已删除")
......
...@@ -92,7 +92,7 @@ class TestHostTypeCreate(object): ...@@ -92,7 +92,7 @@ class TestHostTypeCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_create() response = self.app.hostType_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.create:token的用户已删除") @allure.title("hosttype.create:token的用户已删除")
@allure.story("创建设备类型:token的用户已删除") @allure.story("创建设备类型:token的用户已删除")
......
...@@ -84,7 +84,7 @@ class TestHostTypeDelete(object): ...@@ -84,7 +84,7 @@ class TestHostTypeDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_delete() response = self.app.hostType_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.delete:token的用户已删除") @allure.title("hosttype.delete:token的用户已删除")
@allure.story("删除设备类型:token的用户已删除") @allure.story("删除设备类型:token的用户已删除")
......
...@@ -93,7 +93,7 @@ class TestHostTypeGet(object): ...@@ -93,7 +93,7 @@ class TestHostTypeGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_get() response = self.app.hostType_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.get:token的用户已删除") @allure.title("hosttype.get:token的用户已删除")
@allure.story("查询设备类型:token的用户已删除") @allure.story("查询设备类型:token的用户已删除")
......
...@@ -91,7 +91,7 @@ class TestHostTypeList(object): ...@@ -91,7 +91,7 @@ class TestHostTypeList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_list() response = self.app.hostType_list()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.list:token的用户已删除") @allure.title("hosttype.list:token的用户已删除")
@allure.story("查询设备类型:token的用户已删除") @allure.story("查询设备类型:token的用户已删除")
......
...@@ -96,7 +96,7 @@ class TestHostTypeTree(object): ...@@ -96,7 +96,7 @@ class TestHostTypeTree(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_tree() response = self.app.hostType_tree()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.tree:token的用户已删除") @allure.title("hosttype.tree:token的用户已删除")
@allure.story("查询资产类型树:token的用户已删除") @allure.story("查询资产类型树:token的用户已删除")
......
...@@ -93,7 +93,7 @@ class TestHostTypeUpdate(object): ...@@ -93,7 +93,7 @@ class TestHostTypeUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.hostType_update() response = self.app.hostType_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("hosttype.update:token的用户已删除") @allure.title("hosttype.update:token的用户已删除")
@allure.story("更新设备类型:token的用户已删除") @allure.story("更新设备类型:token的用户已删除")
......
...@@ -108,7 +108,7 @@ class TestInspectionRuleCreate(object): ...@@ -108,7 +108,7 @@ class TestInspectionRuleCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.inspection_rule_create() response = self.app.inspection_rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("inspections.rule.create:token的用户已删除") @allure.title("inspections.rule.create:token的用户已删除")
@allure.story("创建巡检任务:token的用户已删除") @allure.story("创建巡检任务:token的用户已删除")
......
...@@ -100,7 +100,7 @@ class TestInspectionRuleDelete(object): ...@@ -100,7 +100,7 @@ class TestInspectionRuleDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.inspection_rule_create() response = self.app.inspection_rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("inspections.rule.delete:token的用户已删除") @allure.title("inspections.rule.delete:token的用户已删除")
@allure.story("删除巡检任务:token的用户已删除") @allure.story("删除巡检任务:token的用户已删除")
......
...@@ -105,7 +105,7 @@ class TestInspectionRuleGet(object): ...@@ -105,7 +105,7 @@ class TestInspectionRuleGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.inspection_rule_create() response = self.app.inspection_rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("inspections.rule.get:token的用户已删除") @allure.title("inspections.rule.get:token的用户已删除")
@allure.story("查询巡检任务:token的用户已删除") @allure.story("查询巡检任务:token的用户已删除")
......
...@@ -100,7 +100,7 @@ class TestInspectionRuleStatus(object): ...@@ -100,7 +100,7 @@ class TestInspectionRuleStatus(object):
def test_case_01(self): def test_case_01(self):
response = self.app.inspection_rule_create() response = self.app.inspection_rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("inspections.rule.status:token的用户已删除") @allure.title("inspections.rule.status:token的用户已删除")
@allure.story("更新巡检任务状态:token的用户已删除") @allure.story("更新巡检任务状态:token的用户已删除")
......
...@@ -105,7 +105,7 @@ class TestInspectionRuleUpdate(object): ...@@ -105,7 +105,7 @@ class TestInspectionRuleUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.inspection_rule_create() response = self.app.inspection_rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("inspections.rule.update:token的用户已删除") @allure.title("inspections.rule.update:token的用户已删除")
@allure.story("更新巡检任务:token的用户已删除") @allure.story("更新巡检任务:token的用户已删除")
......
...@@ -98,7 +98,7 @@ class TestMembersCreate(object): ...@@ -98,7 +98,7 @@ class TestMembersCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_create() response = self.app.members_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.create:token的用户已删除") @allure.title("members.create:token的用户已删除")
@allure.story("创建用户:token的用户已删除") @allure.story("创建用户:token的用户已删除")
......
...@@ -100,7 +100,7 @@ class TestMembersDelete(object): ...@@ -100,7 +100,7 @@ class TestMembersDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_delete() response = self.app.members_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.delete:token的用户已删除") @allure.title("members.delete:token的用户已删除")
@allure.story("删除用户:token的用户已删除") @allure.story("删除用户:token的用户已删除")
......
...@@ -79,7 +79,7 @@ class TestMembersGet(object): ...@@ -79,7 +79,7 @@ class TestMembersGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_get() response = self.app.members_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.get:token的用户已删除") @allure.title("members.get:token的用户已删除")
@allure.story("查询用户:token的用户已删除") @allure.story("查询用户:token的用户已删除")
......
...@@ -83,7 +83,7 @@ class TestMembersGetRole(object): ...@@ -83,7 +83,7 @@ class TestMembersGetRole(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_get_role() response = self.app.members_get_role()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.get.role:token的用户已删除") @allure.title("members.get.role:token的用户已删除")
@allure.story("获取用户角色:token的用户已删除") @allure.story("获取用户角色:token的用户已删除")
......
...@@ -76,7 +76,7 @@ class TestMembersList(object): ...@@ -76,7 +76,7 @@ class TestMembersList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_list() response = self.app.members_list()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.list:token的用户已删除") @allure.title("members.list:token的用户已删除")
@allure.story("查询用户下拉框:token的用户已删除") @allure.story("查询用户下拉框:token的用户已删除")
......
...@@ -100,7 +100,7 @@ class TestMembersUpdateInfo(object): ...@@ -100,7 +100,7 @@ class TestMembersUpdateInfo(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_update_info() response = self.app.members_update_info()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.update.info:token的用户已删除") @allure.title("members.update.info:token的用户已删除")
@allure.story("更新用户数据:token的用户已删除") @allure.story("更新用户数据:token的用户已删除")
......
...@@ -97,7 +97,7 @@ class TestMembersUpdateStatus(object): ...@@ -97,7 +97,7 @@ class TestMembersUpdateStatus(object):
def test_case_01(self): def test_case_01(self):
response = self.app.members_update_status() response = self.app.members_update_status()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("members.update.status:token的用户已删除") @allure.title("members.update.status:token的用户已删除")
@allure.story("更新用户数据:token的用户已删除") @allure.story("更新用户数据:token的用户已删除")
......
...@@ -170,7 +170,7 @@ class TestRuleCreate(object): ...@@ -170,7 +170,7 @@ class TestRuleCreate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.rule_create() response = self.app.rule_create()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("rule.create:token的用户已删除") @allure.title("rule.create:token的用户已删除")
@allure.story("创建告警规则:token的用户已删除") @allure.story("创建告警规则:token的用户已删除")
......
...@@ -153,7 +153,7 @@ class TestRuleDelete(object): ...@@ -153,7 +153,7 @@ class TestRuleDelete(object):
def test_case_01(self): def test_case_01(self):
response = self.app.rule_delete() response = self.app.rule_delete()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("rule.delete:token的用户已删除") @allure.title("rule.delete:token的用户已删除")
@allure.story("删除告警规则:token的用户已删除") @allure.story("删除告警规则:token的用户已删除")
......
...@@ -132,7 +132,7 @@ class TestRuleGet(object): ...@@ -132,7 +132,7 @@ class TestRuleGet(object):
def test_case_01(self): def test_case_01(self):
response = self.app.rule_get() response = self.app.rule_get()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("rule.get:token的用户已删除") @allure.title("rule.get:token的用户已删除")
@allure.story("查询告警规则:token的用户已删除") @allure.story("查询告警规则:token的用户已删除")
......
...@@ -135,7 +135,7 @@ class TestRuleList(object): ...@@ -135,7 +135,7 @@ class TestRuleList(object):
def test_case_01(self): def test_case_01(self):
response = self.app.rule_list() response = self.app.rule_list()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("rule.list:token的用户已删除") @allure.title("rule.list:token的用户已删除")
@allure.story("查询告警规则下拉框:token的用户已删除") @allure.story("查询告警规则下拉框:token的用户已删除")
......
...@@ -162,7 +162,7 @@ class TestRuleUpdate(object): ...@@ -162,7 +162,7 @@ class TestRuleUpdate(object):
def test_case_01(self): def test_case_01(self):
response = self.app.rule_update() response = self.app.rule_update()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("rule.update:token的用户已删除") @allure.title("rule.update:token的用户已删除")
@allure.story("更新告警规则:token的用户已删除") @allure.story("更新告警规则:token的用户已删除")
......
...@@ -75,7 +75,7 @@ class TestSettingsChangePassword(object): ...@@ -75,7 +75,7 @@ class TestSettingsChangePassword(object):
def test_case_01(self): def test_case_01(self):
response = self.app.settings_changePassword() response = self.app.settings_changePassword()
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("settings.changePassword:token的用户已删除") @allure.title("settings.changePassword:token的用户已删除")
@allure.story("修改密码:token的用户已删除") @allure.story("修改密码:token的用户已删除")
......
...@@ -67,7 +67,7 @@ class TestSettingsGetMember(object): ...@@ -67,7 +67,7 @@ class TestSettingsGetMember(object):
def test_case_01(self): def test_case_01(self):
response = self.app.settings_get_member(memberId=self.base_id) response = self.app.settings_get_member(memberId=self.base_id)
self.app.check_code(response=response, code=2001) self.app.check_code(response=response, code=2001)
self.app.check_msg(response=response, msg="无token,请重新登录") self.app.check_msg(response=response, msg="token不存在")
@allure.title("settings.get.member:token的用户已删除") @allure.title("settings.get.member:token的用户已删除")
@allure.story("查询我的设置:token的用户已删除") @allure.story("查询我的设置:token的用户已删除")
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Argus模块公共封装类 # Argus模块公共封装类
# 作者: 陈磊 # 作者: 陈磊
# 时间: 2019-12-17 # 时间: 2019-12-17
import time
from WorkApi.APP.AddressBook.Iplist.addressbook_iplist_get import AddressBookIplistGet from WorkApi.APP.AddressBook.Iplist.addressbook_iplist_get import AddressBookIplistGet
from WorkApi.APP.AddressBook.addressbook_create import AddressBookCreate from WorkApi.APP.AddressBook.addressbook_create import AddressBookCreate
from WorkApi.APP.AddressBook.addressbook_delete import AddressBookDelete from WorkApi.APP.AddressBook.addressbook_delete import AddressBookDelete
...@@ -494,11 +496,13 @@ class AppBase(object): ...@@ -494,11 +496,13 @@ class AppBase(object):
@allure.step("更新表数据:members -- del_flag") @allure.step("更新表数据:members -- del_flag")
def update_members_del_flag(self, session, members_id=None, value=None): def update_members_del_flag(self, session, members_id=None, value=None):
sql = DataMembers().update_del_flag(session=session, _id=members_id, value=value) sql = DataMembers().update_del_flag(session=session, _id=members_id, value=value)
time.sleep(10)
return sql return sql
@allure.step("更新表数据:members -- status") @allure.step("更新表数据:members -- status")
def update_members_status(self, session, members_id=None, value=None): def update_members_status(self, session, members_id=None, value=None):
sql = DataMembers().update_status(session=session, _id=members_id, value=value) sql = DataMembers().update_status(session=session, _id=members_id, value=value)
time.sleep(10)
return sql return sql
@allure.step("更新表数据:members -- password") @allure.step("更新表数据:members -- password")
......
...@@ -9,9 +9,9 @@ class CaseBase: ...@@ -9,9 +9,9 @@ class CaseBase:
self.app_environment = { self.app_environment = {
# 阿蒙 # 阿蒙
"host": "http://172.16.3.25:3334/api", # "host": "http://172.16.3.25:3334/api",
# 东方 # 东方
# "host": "http://172.16.3.78:3334/api", "host": "http://172.16.3.78:3334/api",
"db_url": "172.16.2.155", "db_url": "172.16.2.155",
"db_port": 3306, "db_port": 3306,
"db_user": "root", "db_user": "root",
......
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