Commit 527fcdbb by sanshi

整个业务代码重构

parent e6cb2a72
......@@ -54,8 +54,5 @@ class BusinessesCreate(object):
base.dict_add_key(_key="memberid", value=self.memberid)
base.dict_add_key(_key="hostids", value=self.hostids)
base.dict_add_key(_key="serviceids", value=self.serviceids)
self.local_json = base._json
self._json = self.local_json
self._json = base._json
self.response = self.api.post(url=self._url, headers=self._headers, json=self._json)
......@@ -3,6 +3,11 @@ from WorkApi.APP.Businesses.Type.businesses_type_create import BusinessesTypeCre
from WorkApi.APP.Businesses.Type.businesses_type_delete import BusinessesTypeDelete
from WorkApi.APP.Businesses.Type.businesses_type_get import BusinessesTypeGet
from WorkApi.APP.Businesses.Type.businesses_type_update import BusinessesTypeUpdate
from WorkApi.APP.Businesses.businesses_create import BusinessesCreate
from WorkApi.APP.Businesses.businesses_delete import BusinessesDelete
from WorkApi.APP.Businesses.businesses_get import BusinessesGet
from WorkApi.APP.Businesses.businesses_tree import BusinessesTree
from WorkApi.APP.Businesses.businesses_update import BusinessesUpdate
from WorkApi.APP.Device.device_create import DeviceCreate
import allure
......@@ -64,6 +69,61 @@ class AppBase(object):
api.get_response()
return api.response
@allure.step("调用接口:businesses.create")
def businesses_create(self, token=None, name=None, description=None, _type=None, principalName=None, principalPhone=None,
memberid=None):
api = BusinessesCreate(_host=self.host)
api.token = token
api.name = name
api.description = description
api.type = _type
api.principalName = principalName
api.principalPhone = principalPhone
api.memberid = memberid
api.get_response()
return api.response
@allure.step("调用接口:businesses.delete")
def businesses_delete(self, token=None, businessidList=None):
api = BusinessesDelete(_host=self.host)
api.token = token
api.businessidList = businessidList
api.get_response()
return api.response
@allure.step("调用接口:businesses.get")
def businesses_get(self, token=None, memberid=None, principal=None, _type=None, hostName=None, businessesName=None):
api = BusinessesGet(_host=self.host)
api.token = token
api.memberid = memberid
api.principal = principal
api.type = _type
api.hostName = hostName
api.businessesName = businessesName
api.get_response()
return api.response
@allure.step("调用接口:businesses.update")
def businesses_update(self, token=None, businessid=None, name=None, description=None, _type=None, principalName=None, principalPhone=None, memberid=None):
api = BusinessesUpdate(_host=self.host)
api.token = token
api.businessid = businessid
api.name = name
api.description = description
api.type = _type
api.principalName = principalName
api.principalPhone = principalPhone
api.memberid = memberid
api.get_response()
return api.response
@allure.step("调用接口:businesses.tree")
def businesses_tree(self, token=None):
api = BusinessesTree(_host=self.host)
api.token = token
api.get_response()
return api.response
@allure.step("调用接口:device.create")
def device_create(self, token=None, hostName=None, hostType=None, manageLevel=None, iplist=None, dns=None,
monitorInterface=None, monitorType=None, parentHost=None, businessIds=None,
......@@ -148,6 +208,12 @@ class AppBase(object):
type_id = UtilsResponse().get_data(response=response)
return type_id
@allure.step("创建测试数据")
def case_create_businesses(self, name, _type, principalPhone=None, principalName=None):
response = self.businesses_create(token=self.token, name=name, _type=_type, principalPhone=principalPhone, principalName=principalName)
business_id = UtilsResponse().get_data(response=response)
return business_id
@allure.step("断言返回结果")
def check_code(self, response, code):
_code = UtilsResponse().get_code(response=response)
......
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