當前位置: 首頁>>代碼示例>>Python>>正文


Python NsmUtil.printResult方法代碼示例

本文整理匯總了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
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:11,代碼來源:test.py

示例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
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:17,代碼來源:test-devkit.py

示例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)])
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:70,代碼來源:test.py

示例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':
#.........這裏部分代碼省略.........
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:103,代碼來源:test-devkit.py

示例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':
#.........這裏部分代碼省略.........
開發者ID:huhe56,項目名稱:nsm-rest-api,代碼行數:103,代碼來源:test-all-old.py


注:本文中的isp.nsmUtil.NsmUtil.printResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。