Commit f5e992ae by sanshi

设备类型

parent 46f04e1a
......@@ -102,9 +102,9 @@ class TestHostTypeGet(object):
return api.response
@allure.step("创建测试数据")
def case_create(self, num, parentId):
title = self.base_title + num
response = self.hostType_create(token=self.token, title=title, parentId=parentId)
def case_create(self, num, parentId, description):
self.title = self.base_title + num
response = self.hostType_create(token=self.token, title=self.title, parentId=parentId, description=description)
self.host_type_id = UtilsResponse().get_data(response=response)
return self.host_type_id
......@@ -125,17 +125,17 @@ class TestHostTypeGet(object):
return sql
@allure.step("校验查询结果")
def check_select(self, response):
def check_select(self, response, title, parent_id, template_ids, interfaces, description, sortid):
data = UtilsResponse().get_data(response=response)
for q, w in enumerate(data["list"]["records"]):
sql = self.select_hosttype(_id=w["id"])
for x, y in enumerate(sql):
assert y.title == w["title"]
assert y.parent_id == w["parentId"]
# assert y.template_ids == w["templateIds"]
# assert y.interfaces == w["interfaces"]
# assert y.description == w["description"]
# assert y.sortid == w["sortid"]
assert y.title == title
assert y.parent_id == parent_id
assert y.template_ids == template_ids
assert y.interfaces == interfaces
assert y.description == description
assert y.sortid == sortid
assert x == 0
@allure.step("断言返回结果")
......@@ -178,16 +178,39 @@ class TestHostTypeGet(object):
self.check_code(response=response, code=2003)
self.check_msg(response=response, msg="账户已被禁用")
@allure.title("hosttype.create:成功查询")
@allure.story("创建业务:成功查询")
@allure.title("hosttype.create:title成功查询")
@allure.story("创建业务:title成功查询")
@allure.severity("blocker")
def test_case_04(self):
self.get_base_token()
self.case_create(num="04", parentId=0)
self.case_create(num="04", parentId=0, description=None)
response = self.hostType_get(token=self.token)
response = self.hostType_get(token=self.token, title=self.title)
self.check_code(response=response, code=0)
self.check_select(response=response, title=self.title, parent_id=0, template_ids=None,
interfaces=None, description=None, sortid=None)
@allure.title("hosttype.create:parentId成功查询")
@allure.story("创建业务:parentId成功查询")
def test_case_05(self):
self.get_base_token()
self.case_create(num="05", parentId=1, description=None)
response = self.hostType_get(token=self.token, parentId=1)
self.check_code(response=response, code=0)
self.check_select(response=response, title=self.title, parent_id=1, template_ids=None,
interfaces=None, description=None, sortid=None)
@allure.title("hosttype.create:description成功查询")
@allure.story("创建业务:description成功查询")
def test_case_06(self):
self.get_base_token()
self.case_create(num="06", parentId=1, description="description")
response = self.hostType_get(token=self.token, description="description")
self.check_code(response=response, code=0)
self.check_select(response=response)
self.check_select(response=response, title=self.title, parent_id=1, template_ids=None,
interfaces=None, description="description", sortid=None)
if __name__ == "__main__":
......@@ -204,4 +227,4 @@ if __name__ == "__main__":
# a = TestHostTypeGet()
# a.setup_class()
# a.test_case_04()
# a.test_case_06()
......@@ -14,6 +14,7 @@ from WorkUtils.UtilsDataBase import UtilsDataBase
import time
Base = declarative_base()
......
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