Commit f54833e8 by sanshi

token 調整

parent 7bb5746c
......@@ -120,7 +120,7 @@ class TestAddressBookIplistGet(object):
def test_case_01(self):
response = self.app.addressbook_iplist_get()
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.story("查询地址簿列表:token的用户已删除")
......
......@@ -45,9 +45,9 @@ class TestAddressBookCreate(object):
base_password = "123456"
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"
@classmethod
......@@ -152,7 +152,7 @@ class TestAddressBookCreate(object):
def test_case_01(self):
response = self.app.addressbook_create()
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.story("创建地址簿:token的用户已删除")
......@@ -190,7 +190,7 @@ class TestAddressBookCreate(object):
def test_case_05(self):
name = self.base_name + "05"
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.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}",
......@@ -228,13 +228,13 @@ if __name__ == "__main__":
import os
# 执行自动化测试用例
case_info = os.path.split(__file__)
case = UtilsCmd().pytest_cmd()
r = UtilsPyTest(case=case, case_info=case_info)
r.run_main()
# a = TestAddressBookCreate()
# a.setup_class()
# a.setup_method()
# a.test_case_04()
# case_info = os.path.split(__file__)
# case = UtilsCmd().pytest_cmd()
# r = UtilsPyTest(case=case, case_info=case_info)
# r.run_main()
a = TestAddressBookCreate()
a.setup_class()
a.setup_method()
a.test_case_05()
......@@ -45,7 +45,7 @@ class TestAddressBookDelete(object):
base_password = "123456"
base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.1.1-254"
base_iplist = "172.16.3.1-254"
@classmethod
def setup_class(cls):
......@@ -112,7 +112,7 @@ class TestAddressBookDelete(object):
def test_case_01(self):
response = self.app.addressbook_delete()
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.story("删除地址簿:token的用户已删除")
......
......@@ -45,7 +45,7 @@ class TestAddressBookDisabled(object):
base_password = "123456"
base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.6.1-254"
base_iplist = "172.16.3.1-254"
@classmethod
def setup_class(cls):
......@@ -122,7 +122,7 @@ class TestAddressBookDisabled(object):
def test_case_01(self):
response = self.app.addressbook_disabled()
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.story("禁用地址簿:token的用户已删除")
......
......@@ -45,7 +45,7 @@ class TestAddressBookEnable(object):
base_password = "123456"
base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.5.1-254"
base_iplist = "172.16.3.1-254"
@classmethod
def setup_class(cls):
......@@ -122,7 +122,7 @@ class TestAddressBookEnable(object):
def test_case_01(self):
response = self.app.addressbook_enabled()
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.story("启用地址簿:token的用户已删除")
......
......@@ -45,7 +45,7 @@ class TestAddressBookGet(object):
base_password = "123456"
base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.5.1-254"
base_iplist = "172.16.3.1-254"
@classmethod
def setup_class(cls):
......@@ -124,7 +124,7 @@ class TestAddressBookGet(object):
def test_case_01(self):
response = self.app.addressbook_get()
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.story("查询地址簿:token的用户已删除")
......
......@@ -46,8 +46,8 @@ class TestAddressBookUpdate(object):
base_password = "123456"
base_name = "SS 自动化专用地址簿"
base_iplist = "192.168.3.1-254"
base_update_iplist = "192.168.4.1-254"
base_iplist = "172.16.3.1-254"
base_update_iplist = "172.16.3.2-254"
base_iprange = "192.168.0.1-254"
base_delay = "1h"
......@@ -154,7 +154,7 @@ class TestAddressBookUpdate(object):
def test_case_01(self):
response = self.app.addressbook_update()
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.story("更新地址簿:token的用户已删除")
......
......@@ -96,7 +96,7 @@ class TestBusinessesCreate(object):
def test_case_01(self):
response = self.app.businesses_create()
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.story("创建业务:token的用户已删除")
......
......@@ -87,7 +87,7 @@ class TestBusinessesDelete(object):
def test_case_01(self):
response = self.app.businesses_delete()
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.story("删除业务:token的用户已删除")
......
......@@ -108,7 +108,7 @@ class TestBusinessesGet(object):
def test_case_01(self):
response = self.app.businesses_get()
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.story("查询业务:token的用户已删除")
......
......@@ -109,7 +109,7 @@ class TestBusinessesTree(object):
def test_case_01(self):
response = self.app.businesses_tree()
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.story("查询业务:token的用户已删除")
......
......@@ -87,7 +87,7 @@ class TestBusinessesTypeCreate(object):
def test_case_01(self):
response = self.app.businesses_type_create()
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.story("创建业务类型:token的用户已删除")
......
......@@ -80,7 +80,7 @@ class TestBusinessesTypeDelete(object):
def test_case_01(self):
response = self.app.businesses_type_delete()
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.story("删除业务类型:token的用户已删除")
......
......@@ -89,7 +89,7 @@ class TestBusinessesTypeGet(object):
def test_case_01(self):
response = self.app.businesses_type_get()
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.story("查询业务类型:token的用户已删除")
......
......@@ -88,7 +88,7 @@ class TestBusinessesTypeUpdate(object):
def test_case_01(self):
response = self.app.businesses_type_update()
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.story("更新业务类型:token的用户已删除")
......
......@@ -104,7 +104,7 @@ class TestBusinessesUpdate(object):
def test_case_01(self):
response = self.app.businesses_update()
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.story("更新业务:token的用户已删除")
......
......@@ -91,7 +91,7 @@ class TestDeviceAssetGetFactoryList(object):
def test_case_01(self):
response = self.app.device_asset_getFactoryList()
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.story("查询品牌下拉框:token的用户已删除")
......
......@@ -102,7 +102,7 @@ class TestDeviceAssetIps(object):
def test_case_01(self):
response = self.app.device_asset_ips()
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.story("查询资产IPS下拉框:token的用户已删除")
......
......@@ -7,11 +7,15 @@
from __future__ import division
from WorkCase import CaseBase
from WorkData.Zabbix.items import DataItems
from WorkUtils.UtilsLog import UtilsLog
from WorkUtils.UtilsDataBase import UtilsDataBase
from WorkUtils.UtilsResponse import UtilsResponse
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
import allure
......@@ -28,6 +32,12 @@ class TestDeviceCreate(object):
db_user = env["db_user"]
db_pw = env["db_pw"]
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"]
login_name = "SS测试用户名"
......@@ -41,8 +51,8 @@ class TestDeviceCreate(object):
base_port = 161
base_name = "SS 自动化专用"
base_business_id_1 = "12"
base_business_id_2 = "13"
base_business_id_1 = 12
base_business_id_2 = 13
@classmethod
def setup_class(cls):
......@@ -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)
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
def teardown_class(cls):
cls.log.debug("结束执行测试套件.......")
......@@ -74,7 +97,8 @@ class TestDeviceCreate(object):
@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)
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
@allure.step("查询表:hosts")
......@@ -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)
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")
def select_interface(self, hostid=None):
session = self.db_session_zabbix()
......@@ -106,7 +136,7 @@ class TestDeviceCreate(object):
def check_select(self, response, name, manage_ip, manage_level, host_type, parent_host,
monitor_status, iplist, dns, monitor_interface, ops_person, factoryId,
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)
sql = self.select_hosts(hostid=data)
assert sql != []
......@@ -123,7 +153,7 @@ class TestDeviceCreate(object):
assert y.iplist == iplist
assert y.dns == dns
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.business_tree == businessTree
# assert y.port == port
......@@ -140,6 +170,14 @@ class TestDeviceCreate(object):
assert y.ipmi_password == ipmi_password
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("校验查询结果")
def check_monitor_type(self, response, name, monitor_type):
data = UtilsResponse().get_data(response=response)
......@@ -155,7 +193,7 @@ class TestDeviceCreate(object):
def test_case_01(self):
response = self.app.device_create()
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.story("创建资产:token的用户已删除")
......@@ -234,19 +272,18 @@ class TestDeviceCreate(object):
response = self.app.device_create(token=self.token, hostName=name, hostType=self.base_type_agent,
iplist=self.base_ip, monitorInterface=self.base_port,
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",
businessTree="businessTree",
opsPerson=11, snmpCommunity="snmpCommunity",
opsPerson=11, snmpCommunity="public",
ipmiAuthtype=1, ipmiPrivilege=1, ipmiUsername="ipmiUsername", ipmiPassword="ipmiPassword",
factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description",
monitorStatus=1)
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,
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,
factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description",
businessIds=self.base_business_id_1 + "," + self.base_business_id_2,
hostTypeTree="hostTypeTree",
businessTree="businessTree")
......@@ -258,12 +295,12 @@ if __name__ == "__main__":
import os
# 执行自动化测试用例
case_info = os.path.split(__file__)
case = UtilsCmd().pytest_cmd()
r = UtilsPyTest(case=case, case_info=case_info)
r.run_main()
# a = TestDeviceCreate()
# a.setup_class()
# a.setup_method()
# a.test_case_04()
# case_info = os.path.split(__file__)
# case = UtilsCmd().pytest_cmd()
# r = UtilsPyTest(case=case, case_info=case_info)
# r.run_main()
a = TestDeviceCreate()
a.setup_class()
a.setup_method()
a.test_case_08()
......@@ -112,7 +112,7 @@ class TestDeviceDelete(object):
def test_case_01(self):
response = self.app.device_delete()
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.story("删除资产:token的用户已删除")
......
......@@ -90,7 +90,7 @@ class TestDeviceGet(object):
def test_case_01(self):
response = self.app.device_get()
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.story("查询资产:token的用户已删除")
......
......@@ -110,7 +110,7 @@ class TestDeviceStatus(object):
def test_case_01(self):
response = self.app.device_status()
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.story("变更状态:token的用户已删除")
......
......@@ -165,7 +165,7 @@ class TestDeviceUpdate(object):
def test_case_01(self):
response = self.app.device_update()
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.story("更新资产:token的用户已删除")
......
......@@ -248,7 +248,7 @@ class TestExperienceCreate(object):
def test_case_01(self):
response = self.app.experience_create()
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.story("创建经验手册:token的用户已删除")
......
......@@ -223,7 +223,7 @@ class TestExperienceDelete(object):
def test_case_01(self):
response = self.app.experience_delete()
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.story("删除经验手册:token的用户已删除")
......
......@@ -10,7 +10,8 @@ from WorkApi.APP.Api.api_login import ApiLogin
from WorkApi.APP.Device.device_create import DeviceCreate
from WorkCase import CaseBase
from WorkCase.APP import AppBase
from WorkData.Argus.members import DataMembers
from WorkData.Zabbix.problem import DataProblem as ZabbixDataProblem
from WorkData.Zabbix.events import DataEvents
from WorkUtils.UtilsLog import UtilsLog
from WorkUtils.UtilsResponse import UtilsResponse
from WorkUtils.UtilsDataBase import UtilsDataBase
......@@ -41,7 +42,7 @@ import allure
@allure.feature("测试模块:experience.get")
class TestExperienceGet(object):
log = UtilsLog()
env = CaseBase().app_environment
env = CaseBase().environment_test
host = env["host"]
db_url = env["db_url"]
db_port = env["db_port"]
......@@ -49,14 +50,21 @@ class TestExperienceGet(object):
db_pw = env["db_pw"]
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"]
login_name = "SS测试用户名"
base_id = 10
base_password = "123456"
base_type_agent = 126
base_type_snmp = 127
base_business_id_1 = "12"
base_business_id_2 = "13"
base_business_id_1 = 12
base_business_id_2 = 13
base_ip = "172.16.3.170"
base_port = 161
......@@ -67,6 +75,8 @@ class TestExperienceGet(object):
base_name = "SS 自动化专用 经验手册相关"
base_eventid = 91000000
session_zabbix = UtilsDataBase().conn_mysql(db_url=db_url_zabbix, db_port=db_port_zabbix, db_base=db_base_zabbix,
db_user=db_user_zabbix, db_pw=db_pw_zabbix)
session = UtilsDataBase().conn_mysql(db_url=db_url, db_port=db_port, db_base=db_base, db_user=db_user, db_pw=db_pw)
@classmethod
......@@ -79,11 +89,14 @@ class TestExperienceGet(object):
sql = DataHosts().select_all_like_host_name(session=cls.session, host_name=cls.base_name)
for x, y in enumerate(sql):
DataHostsItems().delete_host_id(session=cls.session, host_id=y.hostid)
DataProblem().delete_like_name(session=cls.session, name=cls.base_name)
DataProblem().delete_like_eventid(session=cls.session, eventid=cls.base_eventid)
DataHosts().delete_like_host_name(session=cls.session, host_name=cls.base_name)
DataTag().delete_like_tag(session=cls.session, tag=cls.base_name)
DataExperience().delete_like_title(session=cls.session, title=cls.base_title)
ZabbixDataProblem().delete_like_eventid(session=cls.session_zabbix, eventid=cls.base_eventid)
DataEvents().delete_like_eventid(session=cls.session_zabbix, eventid=cls.base_eventid)
@classmethod
def teardown_class(cls):
cls.log.debug("结束执行测试套件.......")
......@@ -180,13 +193,14 @@ class TestExperienceGet(object):
session = self.db_session()
self.alarm_ruleid = DataAlarmRule().insert_one(session=session, name=self.name, status=1, severity=1,
manual_close=0, enable_time_default=1, create_time=1)
manual_close=0, enable_time_default=1, create_time=1,
description="description")
session = self.db_session()
self.businessid = DataBusinesses().insert_one(session=session, name=self.name, _type=1)
self.hostid = self.app.case_create_host(
name=self.name, host_type=self.base_type_snmp, iplist=self.base_ip, port=self.base_port,
businessIds=self.base_business_id_1 + "," + self.base_business_id_2
businessIds=[self.base_business_id_1, self.base_business_id_2]
)
sql = self.select_hosts_items(host_id=self.hostid)
......@@ -241,7 +255,7 @@ class TestExperienceGet(object):
def test_case_01(self):
response = self.app.experience_get()
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.get:token的用户已删除")
@allure.story("查询经验手册:token的用户已删除")
......@@ -317,76 +331,132 @@ class TestExperienceGet(object):
@allure.title("experience.get:manageIp查询")
@allure.story("查询经验手册:manageIp查询")
def test_case_08(self):
self.get_base_token()
title = self.base_title + "08"
content = self.base_content + "08"
description = self.base_description + "08"
self.case_create(num="08")
response = self.experience_get(token=self.token, manageIp=self.base_ip)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, manageIp=self.base_ip)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:businessid查询")
@allure.story("查询经验手册:businessid查询")
def test_case_09(self):
self.get_base_token()
title = self.base_title + "09"
content = self.base_content + "09"
description = self.base_description + "09"
self.case_create(num="09")
response = self.experience_get(token=self.token, businessid=self.businessid)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, businessid=self.businessid)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:alarmRuleid查询")
@allure.story("查询经验手册:alarmRuleid查询")
def test_case_10(self):
self.get_base_token()
title = self.base_title + "10"
content = self.base_content + "10"
description = self.base_description + "10"
self.case_create(num="10")
response = self.experience_get(token=self.token, alarmRuleid=self.alarm_ruleid)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, alarmRuleid=self.alarm_ruleid)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:itemid查询")
@allure.story("查询经验手册:itemid查询")
def test_case_11(self):
self.get_base_token()
title = self.base_title + "11"
content = self.base_content + "11"
description = self.base_description + "11"
self.case_create(num="11")
response = self.experience_get(token=self.token, itemid=self.itemid)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, itemid=self.itemid)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:title查询")
@allure.story("查询经验手册:title查询")
def test_case_12(self):
self.get_base_token()
title = self.base_title + "12"
content = self.base_content + "12"
description = self.base_description + "12"
self.case_create(num="12")
response = self.experience_get(token=self.token, title=self.title)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, title=self.title)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:tagName查询")
@allure.story("查询经验手册:tagName查询")
def test_case_13(self):
self.get_base_token()
title = self.base_title + "13"
content = self.base_content + "13"
description = self.base_description + "13"
self.case_create(num="13")
response = self.experience_get(token=self.token, tagName=self.base_name)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, tagName=self.base_name)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:description查询")
@allure.story("查询经验手册:description查询")
def test_case_14(self):
self.get_base_token()
title = self.base_title + "14"
content = self.base_content + "14"
description = self.base_description + "14"
self.case_create(num="14")
response = self.experience_get(token=self.token, description=self.description)
self.check_code(response=response, code=0)
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, description=self.description)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
@allure.title("experience.get:所有字段查询")
@allure.story("查询经验手册:所有字段查询")
def test_case_15(self):
self.get_base_token()
title = self.base_title + "15"
content = self.base_content + "15"
description = self.base_description + "15"
self.case_create(num="15")
response = self.experience_get(token=self.token, hostType=self.base_type_snmp, manageLevel=1,
self.app.experience_create(token=self.token, title=title, content=content, hostTypes=[self.base_type_snmp],
alarmRuleids=[self.alarm_ruleid], businessids=[self.businessid], hostids=[self.hostid],
manageIpList=[self.hostid], itemids=[self.itemid], problemidList=[self.eventid],
tagNameList=[self.base_name], description=description)
response = self.app.experience_get(token=self.token, hostType=self.base_type_snmp, manageLevel=1,
manageIp=self.base_ip, businessid=self.businessid, alarmRuleid=self.alarm_ruleid,
itemid=self.itemid, title=self.title, tagName=self.base_name,
description=self.description)
self.check_code(response=response, code=0)
self.app.check_code(response=response, code=0)
self.check_select(response=response)
......@@ -405,4 +475,4 @@ if __name__ == "__main__":
a = TestExperienceGet()
a.setup_class()
a.setup_method()
a.test_case_06()
a.test_case_05()
......@@ -96,7 +96,7 @@ class TestExperienceItemsList(object):
def test_case_01(self):
response = self.app.experience_items_list()
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.story("查询监控项下拉框:token的用户已删除")
......
......@@ -152,7 +152,7 @@ class TestExperienceProblemList(object):
def test_case_01(self):
response = self.app.experience_problem_list()
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.story("查询告警下拉框:token的用户已删除")
......
......@@ -304,7 +304,7 @@ class TestExperienceUpdate(object):
def test_case_01(self):
response = self.app.experience_update()
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.story("更新经验手册:token的用户已删除")
......
......@@ -66,7 +66,7 @@ class TestFileUpload(object):
def test_case_01(self):
response = self.app.file_upload()
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.story("文件上传:token的用户已删除")
......
......@@ -92,7 +92,7 @@ class TestHostTypeCreate(object):
def test_case_01(self):
response = self.app.hostType_create()
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.story("创建设备类型:token的用户已删除")
......
......@@ -84,7 +84,7 @@ class TestHostTypeDelete(object):
def test_case_01(self):
response = self.app.hostType_delete()
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.story("删除设备类型:token的用户已删除")
......
......@@ -93,7 +93,7 @@ class TestHostTypeGet(object):
def test_case_01(self):
response = self.app.hostType_get()
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.story("查询设备类型:token的用户已删除")
......
......@@ -91,7 +91,7 @@ class TestHostTypeList(object):
def test_case_01(self):
response = self.app.hostType_list()
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.story("查询设备类型:token的用户已删除")
......
......@@ -96,7 +96,7 @@ class TestHostTypeTree(object):
def test_case_01(self):
response = self.app.hostType_tree()
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.story("查询资产类型树:token的用户已删除")
......
......@@ -93,7 +93,7 @@ class TestHostTypeUpdate(object):
def test_case_01(self):
response = self.app.hostType_update()
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.story("更新设备类型:token的用户已删除")
......
......@@ -108,7 +108,7 @@ class TestInspectionRuleCreate(object):
def test_case_01(self):
response = self.app.inspection_rule_create()
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.story("创建巡检任务:token的用户已删除")
......
......@@ -100,7 +100,7 @@ class TestInspectionRuleDelete(object):
def test_case_01(self):
response = self.app.inspection_rule_create()
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.story("删除巡检任务:token的用户已删除")
......
......@@ -105,7 +105,7 @@ class TestInspectionRuleGet(object):
def test_case_01(self):
response = self.app.inspection_rule_create()
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.story("查询巡检任务:token的用户已删除")
......
......@@ -100,7 +100,7 @@ class TestInspectionRuleStatus(object):
def test_case_01(self):
response = self.app.inspection_rule_create()
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.story("更新巡检任务状态:token的用户已删除")
......
......@@ -105,7 +105,7 @@ class TestInspectionRuleUpdate(object):
def test_case_01(self):
response = self.app.inspection_rule_create()
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.story("更新巡检任务:token的用户已删除")
......
......@@ -98,7 +98,7 @@ class TestMembersCreate(object):
def test_case_01(self):
response = self.app.members_create()
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.story("创建用户:token的用户已删除")
......
......@@ -100,7 +100,7 @@ class TestMembersDelete(object):
def test_case_01(self):
response = self.app.members_delete()
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.story("删除用户:token的用户已删除")
......
......@@ -79,7 +79,7 @@ class TestMembersGet(object):
def test_case_01(self):
response = self.app.members_get()
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.story("查询用户:token的用户已删除")
......
......@@ -83,7 +83,7 @@ class TestMembersGetRole(object):
def test_case_01(self):
response = self.app.members_get_role()
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.story("获取用户角色:token的用户已删除")
......
......@@ -76,7 +76,7 @@ class TestMembersList(object):
def test_case_01(self):
response = self.app.members_list()
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.story("查询用户下拉框:token的用户已删除")
......
......@@ -100,7 +100,7 @@ class TestMembersUpdateInfo(object):
def test_case_01(self):
response = self.app.members_update_info()
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.story("更新用户数据:token的用户已删除")
......
......@@ -97,7 +97,7 @@ class TestMembersUpdateStatus(object):
def test_case_01(self):
response = self.app.members_update_status()
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.story("更新用户数据:token的用户已删除")
......
......@@ -170,7 +170,7 @@ class TestRuleCreate(object):
def test_case_01(self):
response = self.app.rule_create()
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.story("创建告警规则:token的用户已删除")
......
......@@ -153,7 +153,7 @@ class TestRuleDelete(object):
def test_case_01(self):
response = self.app.rule_delete()
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.story("删除告警规则:token的用户已删除")
......
......@@ -132,7 +132,7 @@ class TestRuleGet(object):
def test_case_01(self):
response = self.app.rule_get()
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.story("查询告警规则:token的用户已删除")
......
......@@ -135,7 +135,7 @@ class TestRuleList(object):
def test_case_01(self):
response = self.app.rule_list()
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.story("查询告警规则下拉框:token的用户已删除")
......
......@@ -162,7 +162,7 @@ class TestRuleUpdate(object):
def test_case_01(self):
response = self.app.rule_update()
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.story("更新告警规则:token的用户已删除")
......
......@@ -75,7 +75,7 @@ class TestSettingsChangePassword(object):
def test_case_01(self):
response = self.app.settings_changePassword()
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.story("修改密码:token的用户已删除")
......
......@@ -67,7 +67,7 @@ class TestSettingsGetMember(object):
def test_case_01(self):
response = self.app.settings_get_member(memberId=self.base_id)
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.story("查询我的设置:token的用户已删除")
......
......@@ -2,6 +2,8 @@
# Argus模块公共封装类
# 作者: 陈磊
# 时间: 2019-12-17
import time
from WorkApi.APP.AddressBook.Iplist.addressbook_iplist_get import AddressBookIplistGet
from WorkApi.APP.AddressBook.addressbook_create import AddressBookCreate
from WorkApi.APP.AddressBook.addressbook_delete import AddressBookDelete
......@@ -494,11 +496,13 @@ class AppBase(object):
@allure.step("更新表数据:members -- del_flag")
def update_members_del_flag(self, session, members_id=None, value=None):
sql = DataMembers().update_del_flag(session=session, _id=members_id, value=value)
time.sleep(10)
return sql
@allure.step("更新表数据:members -- status")
def update_members_status(self, session, members_id=None, value=None):
sql = DataMembers().update_status(session=session, _id=members_id, value=value)
time.sleep(10)
return sql
@allure.step("更新表数据:members -- password")
......
......@@ -9,9 +9,9 @@ class CaseBase:
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_port": 3306,
"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