当前位置: 首页>>代码示例>>Python>>正文


Python Util.DictCompare类代码示例

本文整理汇总了Python中Utils.Util.DictCompare的典型用法代码示例。如果您正苦于以下问题:Python DictCompare类的具体用法?Python DictCompare怎么用?Python DictCompare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DictCompare类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_GetProfileInfo_id

 def test_GetProfileInfo_id(self):
     """
     @summary: 根据配置集id获取信息
     @note: 操作成功,验证返回状态码,验证接口返回信息
     """
     # 测试1:根据网络id获取网络信息
     self.flag = True
     LogPrint().info("Test-2: Get profile %s by ID." % self.dm.profile_name)
     profile_id = self.proapi.getProfileIdByName(self.dm.profile_name, self.nw_id)
     r = self.proapi.getProfileInfo(profile_id=profile_id)
     if r["status_code"] == self.dm.expected_status_code:
         dict_actual = r["result"]
         dict_expected = xmltodict.parse((self.dm.profile_info % self.nw_id))
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Get Profile info SUCCESS.")
         else:
             LogPrint().error("FAIL:Returned Profile info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: Returned status code is %s not %s. " % (r["status_code"], self.dm.expected_status_code)
         )
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:25,代码来源:Profile.py

示例2: test_CreateDisk_iscsi_raw

    def test_CreateDisk_iscsi_raw(self): 
        '''
        @note: 在iscsi存储域内创建raw类型磁盘
        @note: 若format=raw,则sparse必须为false,否则报错
        '''
        self.flag = True
        diskapi = DiskAPIs()
        LogPrint().info("Test: Create raw type disk.")
        r = diskapi.createDisk(self.dm.disk_info_raw)
        def is_disk_ok():
            return diskapi.getDiskStatus(self.disk_id)=='ok'
        if r['status_code'] == self.dm.expected_status_code:
            self.disk_id = r['result']['disk']['@id']
            #如果磁盘状态在给定时间内变为ok状态,则继续验证状态码和磁盘信息
            if wait_until(is_disk_ok, 200, 5):
                dict_actual = r['result']
                dict_expected = xmltodict.parse(self.dm.disk_info_raw)
                dictCompare = DictCompare()
                if dictCompare.isSubsetDict(dict_expected, dict_actual):
                    LogPrint().info("PASS: Create raw disk SUCCESS." )
#                 return True
                else:
                    LogPrint().error("FAIL: The disk_info is WRONG")
                    self.flag = False
            else:
                LogPrint().error("FAIL: The disk status is not OK. " )
                self.flag = False
        else:
            LogPrint().error("FAIL: Returned status code is %s. "% r['status_code'])
            self.flag = False
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:30,代码来源:Disk.py

示例3: test_CreateProfile

 def test_CreateProfile(self):
     """
     @summary: 创建配置集
     @note: 操作成功,验证返回状态码,验证接口返回信息
     """
     self.flag = True
     self.proapi = ProfilesAPIs()
     LogPrint().info("Test: Create a profile %s for network %s." % (self.dm.profile_name, self.dm.nw_name))
     r = self.proapi.createProfiles(self.dm.profile_info, self.nw_id)
     if r["status_code"] == self.dm.expected_status_code:
         dict_actual = r["result"]
         dict_expected = xmltodict.parse((self.dm.profile_info % self.nw_id))
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info(
                 "PASS: Create profile %s for network %s SUCCESS." % (self.dm.profile_name, self.dm.nw_name)
             )
         #                 return True
         else:
             LogPrint().error("FAIL:Returned Profile info INCORRECT.")
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: Returned status code is %s not %s. " % (r["status_code"], self.dm.expected_status_code)
         )
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:27,代码来源:Profile.py

示例4: test_GetClusterInfo

 def test_GetClusterInfo(self):
     """
     @summary: 测试用例执行步骤
     @note: (1)获取指定集群的信息;
     @note: (2)验证接口返回的状态码、集群信息是否正确。
     """
     # 测试1:获取集群的信息,并与期望结果进行对比
     self.clusterapi = ClusterAPIs()
     LogPrint().info("Test: Get cluster's ('%s') info." % self.dm.cluster_name)
     r = self.clusterapi.getClusterInfo(self.dm.cluster_name)
     if r["status_code"] == self.dm.status_code:
         dict_actual = r["result"]
         dict_expected = xmltodict.parse(self.dm.cluster_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: Get Cluster '%s' info SUCCESS." % self.dm.cluster_name)
             self.flag = True
         else:
             LogPrint().error("FAIL: Get Cluster '%s' info INCORRECT." % self.dm.cluster_name)
             self.flag = False
     else:
         LogPrint().error(
             "FAIL: Get Cluster '%s' info FAILED. Returned status code '%s' is WRONG."
             % (self.dm.cluster_name, r["status_code"])
         )
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:27,代码来源:Cluster.py

示例5: do_test

 def do_test(xml_info):
     self.flag = True
     r = diskapi.createDisk(xml_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info_list[self.expected_result_index]), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
     self.expected_result_index += 1
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:15,代码来源:Disk.py

示例6: do_test

 def do_test(xml_info):
     r = sd_api.createStorageDomain(xml_info)
     # 验证接口返回状态码是否正确
     if r['status_code'] == self.dm.expected_status_code_create_sd_fail:
         # 验证接口返回提示信息是否正确
         sd_path = xmltodict.parse(xml_info)['storage_domain']['storage']['path']
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info_create_sd_fail), r['result']):
             LogPrint().info("PASS: Returned status code and messages are CORRECT when create storage domain with invalid Path '%s'." % sd_path)
             self.flag = True
         else:
             LogPrint().error("FAIL: Returned messages are INCORRECT when create storage domain with the invalid Path '%s'." % sd_path)
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code '%s' is INCORRECT." % (r['status_code']))
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:17,代码来源:StorageDomain.py

示例7: test_GetClusterNetworkInfo

 def test_GetClusterNetworkInfo(self):
     """
     @summary: 测试用例执行步骤
     @note: 操作成功,验证网络信息
     """
     LogPrint().info("Test: Get the cluster %s's network info. " % self.dm.cluster_name)
     r = self.clusterapi.getClusterNetworkInfo(self.dm.cluster_name, self.dm.nw_name)
     dict_actual = r
     dict_expected = xmltodict.parse(self.dm.nw_info)
     dictCompare = DictCompare()
     if dictCompare.isSubsetDict(dict_expected, dict_actual):
         LogPrint().info("PASS: Get ClusterNetwork '%s' info SUCCESS." % self.dm.nw_name)
     #                 return True
     else:
         LogPrint().error("FAIL: Returned message is WRONG. ")
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:17,代码来源:Cluster.py

示例8: do_test

 def do_test(xml_info):
     LogPrint().info("Test: Create nic %s for template %s."%(self.dm.nic_name[self.expected_result_index], self.dm.temp_name))
     r =  tempnic_api.createTemplateNic(self.dm.temp_name, xml_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         print xml_info
         expected_result = xmltodict.parse(xml_info)
         actual_result = r['result']
         if dictCompare.isSubsetDict(expected_result,actual_result):
             LogPrint().info("PASS: Create Nic %s SUCCESS."%self.dm.nic_name[self.expected_result_index])
         else:
             LogPrint().error("FAIL: The nic %s info is WRONG"%self.dm.nic_name[self.expected_result_index])
             self.flag = False
     else:
         LogPrint().error("FAIL: The status_code is WRONG")
         self.flag = False
     self.assertTrue(self.flag)
     self.expected_result_index += 1
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:18,代码来源:Template.py

示例9: test_CreateProfile_DupName

 def test_CreateProfile_DupName(self):
     """
     @note: 操作失败,检查返回状态码和提示信息
     """
     self.flag = True
     LogPrint().info("Test: Create a dupname profile for network %s." % self.dm.nw_name)
     r = self.proapi.createProfiles(self.dm.profile_info, self.nw_id)
     if r["status_code"] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r["result"], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: The returned status code and messages are CORRECT when create dup profile.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECCT when create dup profile.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s', INCORRECT. " % r["status_code"])
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:18,代码来源:Profile.py

示例10: do_test

 def do_test(xml_info):
     self.flag = True
     r = clusterapi.updateCluster(self.dm.cluster_name, xml_info)
     if r["status_code"] == self.dm.status_code:
         dict_actual = r["result"]
         dict_expected = xmltodict.parse(xml_info)
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(dict_expected, dict_actual):
             LogPrint().info("PASS: ITC02010401_UpdateCluster_nohost SUCCESS.")
             self.flag = True
         else:
             LogPrint().error("FAIL: ITC02010401_UpdateCluster_nohost.Error-info  INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: ITC02010401_UpdateCluster_nohost FAILED.Status-code WRONG. ")
         self.flag = False
     self.assertTrue(self.flag)
     self.expected_result_index += 1
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:18,代码来源:Cluster.py

示例11: test_CreateNetwork_DupVlan

 def test_CreateNetwork_DupVlan(self):
     '''
     @summary: 创建网络,vlan id重复
     @note: 操作失败,检查返回状态码和报错信息
     '''
     LogPrint().info("Test: Create network %s.Set its vlan id 2."%self.dm.nw_name2)
     r = self.nwapi.createNetwork(self.dm.nw_info2)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r['result'], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: Returned status code and messages are CORRECT when create dup_vlan network.")
             self.flag = True
         else:
             LogPrint().error("FAIL: Returned messages are INCORRECCT when create dup_vlan network.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Returned status code is '%s', INCORRECT. " % r['status_code'])
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:19,代码来源:Network.py

示例12: test_CreateDisk_VerifyName

 def test_CreateDisk_VerifyName(self):
     '''
     @summary: 验证名称合法性:包含非法字符
     @note: 操作失败,验证返回状态码及报错信息
     ''' 
     diskapi = DiskAPIs()
     LogPrint().info("Test: Create disk and verify name.")
     r = diskapi.createDisk(self.dm.disk_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
             LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
             self.flag = False
     self.assertTrue(self.flag)
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:19,代码来源:Disk.py

示例13: test_DeleteDisk_AttachtoRunVm

 def test_DeleteDisk_AttachtoRunVm(self): 
     '''
     @summary: 删除附加到运行虚拟机的磁盘
     @note: 操作失败,验证返回状态码和报错信息
     '''
     self.flag = True
     LogPrint().info("Test: Delete disk %s attached to running vm %s."% (self.dm.disk_name, self.dm.vm_name))
     r = self.diskapi.deleteDisk(self.disk_id)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(xmltodict.parse(self.dm.expected_info), r['result']):
             LogPrint().info("PASS: The returned status code and messages are CORRECT.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECT.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s' while it should be '%s'." % (r['status_code'], self.dm.expected_status_code))
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:19,代码来源:Disk.py

示例14: test_CreateTemplate_VerifyName

 def test_CreateTemplate_VerifyName(self):
     '''
     @summary: 创建模板,名称不合法
     @note: 操作失败,验证返回状态码和返回信息
     '''
     self.tempapi = TemplatesAPIs()
     LogPrint().info("Test: Create template %s."%self.dm.temp_name)
     r = self.tempapi.createTemplate(self.dm.temp_info)
     if r['status_code'] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         d1 = xmltodict.parse(self.dm.expected_info)
         if dictCompare.isSubsetDict(d1, r['result']):
             LogPrint().info("PASS: Returned status code and messages are CORRECT when create host with dup name.")
         else:
             LogPrint().error("FAIL: Returned messages are incorrectly.")
             self.flag = False
     else:
         LogPrint().error("FAIL: Status-code is WRONG.")
         self.assertTrue(False)
开发者ID:faylau,项目名称:oVirt3.3WebAPITest,代码行数:19,代码来源:Template.py

示例15: test_UpdateNetwork

 def test_UpdateNetwork(self):
     """
     @summary: 编辑配置集,更改所属网络
     @note: 操作失败,验证返回状态码,验证报错信息
     """
     self.flag = True
     LogPrint().info("Test: Update profile %s.Change its network." % self.dm.profile_name)
     r = self.proapi.updateProfile(self.dm.profile_name, self.nw_id, self.dm.update_info)
     if r["status_code"] == self.dm.expected_status_code:
         dictCompare = DictCompare()
         if dictCompare.isSubsetDict(r["result"], xmltodict.parse(self.dm.expected_info)):
             LogPrint().info("PASS: The returned status code and messages are CORRECT when update dup network.")
         else:
             LogPrint().error("FAIL: The returned messages are INCORRECCT when update dup network.")
             self.flag = False
     else:
         LogPrint().error("FAIL: The returned status code is '%s', INCORRECT. " % r["status_code"])
         self.flag = False
     self.assertTrue(self.flag)
开发者ID:FineFan,项目名称:oVirt3.3WebAPITest,代码行数:19,代码来源:Profile.py


注:本文中的Utils.Util.DictCompare类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。