本文整理汇总了Python中isp.nsmUtil.NsmUtil.printResult方法的典型用法代码示例。如果您正苦于以下问题:Python NsmUtil.printResult方法的具体用法?Python NsmUtil.printResult怎么用?Python NsmUtil.printResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类isp.nsmUtil.NsmUtil
的用法示例。
在下文中一共展示了NsmUtil.printResult方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testUpdateVerification
# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printResult [as 别名]
def testUpdateVerification(self, result, thisObject, pod, updateVerificationPatternList, className, name, category, testCaseId,storage):
if result and Define._Verfiy and Define._VerifyUpdate:
thisObject.setPod(pod)
result = thisObject.verifyUpdate(updateVerificationPatternList, storage)
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, 'update-verify', category, str(testCaseId), str(result)])
return result
else:
return None
示例2: testIpAddressPool
# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printResult [as 别名]
def testIpAddressPool(self, provider, poolType, online):
NsmUtil.printHeadLine2('IpAddressPool' + ' [' + poolType + '] - ' + 'detail' + ' - ' + 'positive' + ' - test case ' + str(1))
self._totalTestCase += 1
ipAddressPoolUid = None
if poolType == 'Global': ipAddressPoolUid = provider.getGlobalIpAddressPoolUid()
else: ipAddressPoolUid = provider.getInfrastructureIpAddressPoolUid()
ipAddressPool = IpAddressPool(ipAddressPoolUid, 'Provider', poolType)
if not online: ipAddressPool.setOffLine()
ipAddressPoolDetail = ipAddressPool.getDetail()
assert ipAddressPoolDetail
result = NsmUtil.printResult(ipAddressPoolDetail, 'positive')
self._resultList.append(['IpAddressPool', poolType, 'detail', 'positive', str(1), str(result)])
return ipAddressPool
示例3: run
# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printResult [as 别名]
#.........这里部分代码省略.........
if Define._StressTest:
uidObjectName = self.getStressObjectName(uidObjectName, uidClassName)
testCase[uidVariable] = self.getUid(uidClassName, uidObjectName)
if not testCase[uidVariable]:
self._logger.error('-------->>>>>> uid for ' + uidClassName + ' [' + uidObjectName + '] can not be None' )
continue
del testCase['uids']
if action != 'update':
NsmUtil.printHeadLine2(className + ' [' + name + '] - ' + action + ' - ' + category + ' - test case ' + str(testCaseId))
try:
if action == 'create':
if online: thisObject.setOnLine()
elif not online: thisObject.setOffLine()
if Define._Performance and NsmUtil.isPerfClass(className):
Define._CurrentPerfClassName = className
Define._CurrentPerfObjectName = name
Define._CurrentPerfAction = action
if name: thisObject.setCreateName(name)
if description: thisObject.setCreateDescription(description)
if requestBodyFileName: thisObject.setRequestBodyFile(requestBodyFileName)
if testCase: thisObject.setRequestBodyParams(testCase)
result = thisObject.create(testCaseId)
name = thisObject.createName
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
if Define._Performance and NsmUtil.isPerfClass(className):
Define._CurrentPerfClassName = None
Define._CurrentPerfObjectName = None
Define._CurrentPerfAction = None
if Define._Performance and (className == 'Tenant' or className == 'ProviderNetworkContainer'):
Define._PerformanceData.setCurrentTenantName(name)
if not className in self._dataStore.keys(): self._dataStore[className] = {}
if not name in self._dataStore[className].keys(): self._dataStore[className][name] = {}
self._dataStore[className][name]['object'] = thisObject
self._thisObject = thisObject
if result and Define._Verfiy and Define._VerifyCreate:
thisObject.setPod(pod)
result = thisObject.verifyCreate()
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, 'create-verify', category, str(testCaseId), str(result)])
elif action == 'detail':
if online: thisObject.setOnLine()
elif not online: thisObject.setOffLine()
detail = thisObject.getDetail(testCaseId)
name = thisObject.createName
result = NsmUtil.printResult(detail, category)
self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
示例4: run
# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printResult [as 别名]
def run(self, catalog, testCaseFileName, online):
testCaseFilePath = Define._PathTestCase + '/' + testCaseFileName
json_data = open(testCaseFilePath)
self._logger.debug('test case json file path: ' + testCaseFilePath)
data = json.load(json_data)
#pprint(data)
json_data.close()
for className, testSuite in data.items():
NsmUtil.printHeadLine1(' class: ' + className )
thisObject = eval(className)(catalog, None, None, None, None)
index = 0;
name = None
for testCase in testSuite:
index += 1
self._totalTestCase += 1
skip = None
action = None
category = None
requestBodyFileName = None
description = None
action = testCase['action']
category = testCase['category']
if 'skip' in testCase.keys(): skip = testCase['skip']
if 'request.body.file' in testCase.keys(): requestBodyFileName = testCase['request.body.file']
if 'name' in testCase.keys(): name = testCase['name']
if 'description' in testCase.keys(): description = testCase['description']
if 'uids' in testCase.keys():
for oneUid in testCase['uids']:
uidVariable = oneUid['variable']
uidClassName = oneUid['class']
uidObjectName = oneUid['name']
testCase[uidVariable] = self.getUid(uidClassName, uidObjectName)
if not testCase[uidVariable]:
self._logger.error('-------->>>>>> uid for ' + uidClassName + ' [' + uidObjectName + '] can not be None' )
continue
del testCase['uids']
NsmUtil.printHeadLine2(className + ' [' + name + '] - ' + action + ' - ' + category + ' - test case ' + str(index))
if skip:
self._logger.info('skip this test case')
self._resultList.append([className, name, action, category, str(index), 'skipped'])
continue
if action == 'create' or action == 'update':
if name: thisObject.setCreateName(name)
if description: thisObject.setCreateDescription(description)
if requestBodyFileName: thisObject.setRequestBodyFile(requestBodyFileName)
if testCase: thisObject.setRequestBodyParams(testCase)
if action == 'create':
if not online: thisObject.setOffLine()
result = thisObject.create()
name = thisObject.createName
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, action, category, str(index), str(result)])
self._dataStore[className] = {}
self._dataStore[className][name] = {}
self._dataStore[className][name]['object'] = thisObject
self._thisObject = thisObject
elif action == 'detail':
if not online: thisObject.setOffLine()
detail = thisObject.getDetail()
name = thisObject.createName
result = NsmUtil.printResult(detail, category)
self._resultList.append([className, name, action, category, str(index), str(result)])
newUid = [thisObject.uid, thisObject.mySubClassName, thisObject.createName]
self.addUid(newUid)
self._dataStore[className][name]['detail'] = detail
elif action == 'catalog':
if not online: thisObject.setOffLine()
catalog = thisObject.getCatalog()
name = thisObject.createName
result = NsmUtil.printResult(catalog, category)
self._resultList.append([className, name, action, category, str(index), str(result)])
self._dataStore[className][name]['catalog'] = catalog
elif action == 'update' and online:
result = thisObject.update(className, testCase, category, index)
name = thisObject.createName
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, action, category, str(index), str(result)])
elif action == 'delete' and online:
result = thisObject.delete()
name = thisObject.createName
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, action, category, str(index), str(result)])
elif action == 'list':
if not online: thisObject.setOffLine()
listUrl = None
if className == 'Provider':
listUrl = Define._UrlApiRoot + '/top/provider'
elif className == 'Pod':
#.........这里部分代码省略.........
示例5: run
# 需要导入模块: from isp.nsmUtil import NsmUtil [as 别名]
# 或者: from isp.nsmUtil.NsmUtil import printResult [as 别名]
def run(self, catalog, testCaseFileName, online):
testCaseFilePath = Define._PathTestCase + '/' + testCaseFileName
json_data = open(testCaseFilePath)
self._logger.debug('test case json file path: ' + testCaseFilePath)
data = json.load(json_data)
#pprint(data)
json_data.close()
for className, testSuite in data.items():
NsmUtil.printHeadLine1(' class: ' + className )
thisObject = eval(className)(catalog, None, None, None, None)
name = None
for testCase in testSuite:
self._totalTestCase += 1
testCaseId = None
action = None
category = None
requestBodyFileName = None
description = None
testCaseId = testCase['id']
action = testCase['action']
category = testCase['category']
if 'skip' in testCase.keys() and testCase['skip'] == 'true':
self._logger.info('skip this test case')
self._resultList.append([className, name, action, category, str(testCaseId), 'skipped'])
continue
if 'online' in testCase.keys() and testCase['online'] == 'true': online = True
if 'request.body.file' in testCase.keys(): requestBodyFileName = testCase['request.body.file']
if 'name' in testCase.keys(): name = testCase['name']
if 'description' in testCase.keys(): description = testCase['description']
for ipv4StartKey, ipv4StartValue in testCase.items():
if ipv4StartKey.endswith('ipv4.start'):
if ipv4StartValue == 'InternetEdgeZoneLayer3VlanReservedIpAddress':
oneIpAddress = self._internetEdgeZoneLayer3VlanReservedIpAddressList.pop()
testCase[ipv4StartKey] = oneIpAddress
ipv4EndKey = ipv4StartKey.replace('.ipv4.start', '.ipv4.end')
testCase[ipv4EndKey] = oneIpAddress
elif ipv4StartValue == 'SecuredInternetEdgeZoneLayer3VlanReservedIpAddress':
oneIpAddress = self._securedInternetEdgeZoneLayer3VlanReservedIpAddressList.pop()
testCase[ipv4StartKey] = oneIpAddress
ipv4EndKey = ipv4StartKey.replace('.ipv4.start', '.ipv4.end')
testCase[ipv4EndKey] = oneIpAddress
if 'uids' in testCase.keys():
for oneUid in testCase['uids']:
uidVariable = oneUid['variable']
uidClassName = oneUid['class']
uidObjectName = oneUid['name']
testCase[uidVariable] = self.getUid(uidClassName, uidObjectName)
if not testCase[uidVariable]:
self._logger.error('-------->>>>>> uid for ' + uidClassName + ' [' + uidObjectName + '] can not be None' )
continue
del testCase['uids']
if action != 'update':
NsmUtil.printHeadLine2(className + ' [' + name + '] - ' + action + ' - ' + category + ' - test case ' + str(testCaseId))
try:
if action == 'create':
if online: thisObject.setOnLine()
elif not online: thisObject.setOffLine()
if name: thisObject.setCreateName(name)
if description: thisObject.setCreateDescription(description)
if requestBodyFileName: thisObject.setRequestBodyFile(requestBodyFileName)
if testCase: thisObject.setRequestBodyParams(testCase)
result = thisObject.create(testCaseId)
name = thisObject.createName
result = NsmUtil.printResult(result, category)
self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
if not className in self._dataStore.keys(): self._dataStore[className] = {}
if not name in self._dataStore[className].keys(): self._dataStore[className][name] = {}
self._dataStore[className][name]['object'] = thisObject
self._thisObject = thisObject
elif action == 'detail':
if online: thisObject.setOnLine()
elif not online: thisObject.setOffLine()
detail = thisObject.getDetail(testCaseId)
name = thisObject.createName
result = NsmUtil.printResult(detail, category)
self._resultList.append([className, name, action, category, str(testCaseId), str(result)])
self.addUid([thisObject.uid, thisObject.mySubClassName, thisObject.createName])
self._dataStore[className][name]['detail'] = detail
if className == 'IpReservation' or className == 'IpAddressPool':
#.........这里部分代码省略.........