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


Python MatchesStructure.byEquality方法代码示例

本文整理汇总了Python中testtools.matchers.MatchesStructure.byEquality方法的典型用法代码示例。如果您正苦于以下问题:Python MatchesStructure.byEquality方法的具体用法?Python MatchesStructure.byEquality怎么用?Python MatchesStructure.byEquality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testtools.matchers.MatchesStructure的用法示例。


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

示例1: test_values

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_values(self):
     task = self.factory.makeBugTask()
     with person_logged_in(task.product.owner):
         task.transitionToAssignee(self.factory.makePerson())
         task.transitionToMilestone(
             self.factory.makeMilestone(product=task.product),
             task.product.owner)
         task.bug.markAsDuplicate(self.factory.makeBug())
     flat = self.getBugTaskFlat(task)
     self.assertThat(
         flat,
         MatchesStructure.byEquality(
             bugtask=task.id,
             bug=task.bug.id,
             datecreated=task.datecreated.replace(tzinfo=None),
             duplicateof=task.bug.duplicateof.id,
             bug_owner=task.bug.owner.id,
             information_type=task.bug.information_type.value,
             date_last_updated=task.bug.date_last_updated.replace(
                 tzinfo=None),
             heat=task.bug.heat,
             product=task.product.id,
             productseries=None,
             distribution=None,
             distroseries=None,
             sourcepackagename=None,
             status=task.status.value,
             importance=task.importance.value,
             assignee=task.assignee.id,
             milestone=task.milestone.id,
             owner=task.owner.id,
             active=task.product.active,
             access_policies=None,
             access_grants=None))
     self.assertIsNot(None, flat.fti)
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:37,代码来源:test_bugtaskflat_triggers.py

示例2: _dup_work_items_set_up

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
    def _dup_work_items_set_up(self):
        spec = self.factory.makeSpecification(
            product=self.factory.makeProduct())
        login_person(spec.owner)
        # Create two work-items in our database.
        wi1_data = self._createWorkItemAndReturnDataDict(spec)
        wi2_data = self._createWorkItemAndReturnDataDict(spec)

        # Create a duplicate and a near duplicate, insert into DB.
        new_wi1_data = wi2_data.copy()
        new_wi2_data = new_wi1_data.copy()
        new_wi2_data['status'] = SpecificationWorkItemStatus.DONE
        work_items = [new_wi1_data, wi1_data, new_wi2_data, wi2_data]
        spec.updateWorkItems(work_items)

        # Update our data dicts with the sequences to match data in DB
        new_wi1_data['sequence'] = 0
        wi1_data['sequence'] = 1
        new_wi2_data['sequence'] = 2
        wi2_data['sequence'] = 3

        self.assertEqual(4, len(spec.work_items))
        for data, obj in zip(work_items, spec.work_items):
            self.assertThat(obj, MatchesStructure.byEquality(**data))

        return spec, work_items
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:28,代码来源:test_specification.py

示例3: test__Version_read

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test__Version_read(self):
     session = bones.SessionAPI(self.description)
     action = session.Version.read
     self.assertThat(action, MatchesStructure.byEquality(
         name="read", fullname="Version.read", method="GET",
         handler=session.Version, is_restful=True, op=None,
     ))
开发者ID:alburnum,项目名称:alburnum-maas-client,代码行数:9,代码来源:test_bones.py

示例4: test_WithNativeArgs

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_WithNativeArgs(self):
     # Options can be passed as the string representations of the
     # types the script wants them in.
     options = parse_opts([
         '--submitter=1',
         '--reviewer=2',
         '--id=3',
         '--id=4',
         '--potemplate=5',
         '--language=te',
         '--not-language',
         '--is-current-ubuntu=True',
         '--is-current-upstream=False',
         '--msgid=Hello',
         '--origin=1',
         '--force',
         ])
     self.assertThat(options, MatchesStructure.byEquality(
         submitter=1,
         reviewer=2,
         ids=[3, 4],
         potemplate=5,
         language='te',
         not_language=True,
         is_current_ubuntu=True,
         is_current_upstream=False,
         origin=1,
         force=True))
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:30,代码来源:test_remove_translations.py

示例5: test_merge_accesspolicygrants_conflicts

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
    def test_merge_accesspolicygrants_conflicts(self):
        # Conflicting AccessPolicyGrants are deleted.
        policy = self.factory.makeAccessPolicy()

        person = self.factory.makePerson()
        person_grantor = self.factory.makePerson()
        person_grant = self.factory.makeAccessPolicyGrant(
            grantee=person, grantor=person_grantor, policy=policy)
        person_grant_date = person_grant.date_created

        duplicate = self.factory.makePerson()
        duplicate_grantor = self.factory.makePerson()
        self.factory.makeAccessPolicyGrant(
            grantee=duplicate, grantor=duplicate_grantor, policy=policy)

        self._do_premerge(duplicate, person)
        with person_logged_in(person):
            self._do_merge(duplicate, person)

        # Only one grant for the policy exists: the retained person's.
        source = getUtility(IAccessPolicyGrantSource)
        self.assertThat(
            source.findByPolicy([policy]).one(),
            MatchesStructure.byEquality(
                policy=policy,
                grantee=person,
                date_created=person_grant_date))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:29,代码来源:test_personmerge.py

示例6: test_updateWorkItems_merges_with_existing_ones

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
    def test_updateWorkItems_merges_with_existing_ones(self):
        spec = self.factory.makeSpecification(
            product=self.factory.makeProduct())
        login_person(spec.owner)
        # Create two work-items in our database.
        wi1_data = self._createWorkItemAndReturnDataDict(spec)
        wi2_data = self._createWorkItemAndReturnDataDict(spec)
        self.assertEqual(2, len(spec.work_items))

        # These are the work items we'll be inserting.
        new_wi1_data = dict(
            title=u'Some Title', status=SpecificationWorkItemStatus.TODO,
            assignee=None, milestone=None)
        new_wi2_data = dict(
            title=u'Other title', status=SpecificationWorkItemStatus.TODO,
            assignee=None, milestone=None)

        # We want to insert the two work items above in the first and third
        # positions respectively, so the existing ones to be moved around
        # (e.g. have their sequence updated).
        work_items = [new_wi1_data, wi1_data, new_wi2_data, wi2_data]
        spec.updateWorkItems(work_items)

        # Update our data dicts with the sequences we expect the work items in
        # our DB to have.
        new_wi1_data['sequence'] = 0
        wi1_data['sequence'] = 1
        new_wi2_data['sequence'] = 2
        wi2_data['sequence'] = 3

        self.assertEqual(4, len(spec.work_items))
        for data, obj in zip(work_items, list(spec.work_items)):
            self.assertThat(obj, MatchesStructure.byEquality(**data))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:35,代码来源:test_specification.py

示例7: test__Machines_deployment_status

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test__Machines_deployment_status(self):
     session = bones.SessionAPI(self.description, ("a", "b", "c"))
     action = session.Machines.deployment_status
     self.assertThat(action, MatchesStructure.byEquality(
         name="deployment_status", fullname="Machines.deployment_status",
         method="GET", handler=session.Machines, is_restful=False,
         op="deployment_status",
     ))
开发者ID:alburnum,项目名称:alburnum-maas-client,代码行数:10,代码来源:test_bones.py

示例8: test_toTerm_empty_description

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_toTerm_empty_description(self):
     archive = self.factory.makeArchive(description='')
     vocab = PPAVocabulary()
     term = vocab.toTerm(archive)
     self.assertThat(term, MatchesStructure.byEquality(
         value=archive,
         token='%s/%s' % (archive.owner.name, archive.name),
         title='No description available'))
开发者ID:vitaminmoo,项目名称:unnaturalcode,代码行数:10,代码来源:test_vocabularies.py

示例9: test_initialisation

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_initialisation(self):
     server_address = factory.getRandomString()
     shared_key = factory.getRandomString()
     shell = Omshell(server_address, shared_key)
     self.assertThat(
         shell, MatchesStructure.byEquality(
             server_address=server_address,
             shared_key=shared_key))
开发者ID:deepakhajare,项目名称:maas,代码行数:10,代码来源:test_omshell.py

示例10: test_getTermByToken

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_getTermByToken(self):
     vocab = InformationTypeVocabulary([InformationType.PUBLIC])
     self.assertThat(
         vocab.getTermByToken('PUBLIC'),
         MatchesStructure.byEquality(
             value=InformationType.PUBLIC,
             token='PUBLIC',
             title='Public',
             description=InformationType.PUBLIC.description))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:11,代码来源:test_information_type_vocabulary.py

示例11: test_productseries_target

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_productseries_target(self):
     ps = self.factory.makeProductSeries()
     task = self.factory.makeBugTask(target=ps)
     flat = self.getBugTaskFlat(task)
     self.assertThat(
         flat,
         MatchesStructure.byEquality(
             product=None, productseries=ps.id, distribution=None,
             distroseries=None, sourcepackagename=None, active=True))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:11,代码来源:test_bugtaskflat_triggers.py

示例12: test_delete_duplicate_work_item

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
    def test_delete_duplicate_work_item(self):
        spec, work_items = self._dup_work_items_set_up()

        # Delete a duplicate work item
        work_items.pop()
        spec.updateWorkItems(work_items)

        self.assertEqual(3, len(spec.work_items))
        for data, obj in zip(work_items, list(spec.work_items)):
            self.assertThat(obj, MatchesStructure.byEquality(**data))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:12,代码来源:test_specification.py

示例13: test_sourcepackage_target

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_sourcepackage_target(self):
     sp = self.factory.makeSourcePackage()
     task = self.factory.makeBugTask(target=sp)
     flat = self.getBugTaskFlat(task)
     self.assertThat(
         flat,
         MatchesStructure.byEquality(
             product=None, productseries=None, distribution=None,
             distroseries=sp.distroseries.id,
             sourcepackagename=sp.sourcepackagename.id, active=True))
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:12,代码来源:test_bugtaskflat_triggers.py

示例14: test_creates_commissioning_script

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_creates_commissioning_script(self):
     content = factory.getRandomString()
     name = factory.make_name('filename')
     uploaded_file = SimpleUploadedFile(content=content, name=name)
     form = CommissioningScriptForm(files={'content': uploaded_file})
     self.assertTrue(form.is_valid(), form._errors)
     form.save()
     new_script = CommissioningScript.objects.get(name=name)
     self.assertThat(
         new_script,
         MatchesStructure.byEquality(name=name, content=content))
开发者ID:deepakhajare,项目名称:maas,代码行数:13,代码来源:test_forms.py

示例15: test_new_creates_nodegroup_with_given_dhcp_settings

# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import byEquality [as 别名]
 def test_new_creates_nodegroup_with_given_dhcp_settings(self):
     name = factory.make_name('nodegroup')
     uuid = factory.make_name('uuid')
     dhcp_network, dhcp_settings = make_dhcp_settings()
     ip = factory.getRandomIPInNetwork(dhcp_network)
     nodegroup = NodeGroup.objects.new(name, uuid, ip, **dhcp_settings)
     nodegroup = reload_object(nodegroup)
     interface = get_one(nodegroup.nodegroupinterface_set.all())
     self.assertEqual(name, nodegroup.name)
     self.assertThat(
         interface, MatchesStructure.byEquality(**dhcp_settings))
开发者ID:cloudbase,项目名称:maas,代码行数:13,代码来源:test_nodegroup.py


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