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


Python mockito.verifyNoMoreInteractions函数代码示例

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


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

示例1: test_register_should_call_listener_for_existent_reference_when_there_is_one_selector

    def test_register_should_call_listener_for_existent_reference_when_there_is_one_selector(self):
        reference = 'REFERENCE'
        selection = [reference]

        self.manager.register(self.listener_callable_mock, selection)
        verify(self.listener_mock, times=1).__call__(reference)
        verifyNoMoreInteractions(self.listener_mock)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:7,代码来源:tagselection_tests.py

示例2: testPrintsUnwantedInteraction

 def testPrintsUnwantedInteraction(self):
   theMock = mock()
   theMock.foo(1, 'foo')
   try:
     verifyNoMoreInteractions(theMock)
   except VerificationError, e:
     self.assertEquals("\nUnwanted interaction: foo(1, 'foo')", str(e))
开发者ID:nyeddi,项目名称:pybuilder_proj,代码行数:7,代码来源:verification_errors_test.py

示例3: testVerifyNoMoreInteractionsWorks

    def testVerifyNoMoreInteractionsWorks(self, verification):
        rex = Dog()
        expect(rex, **verification).bark('Miau').thenReturn('Wuff')
        rex.bark('Miau')
        rex.bark('Miau')

        verifyNoMoreInteractions(rex)
开发者ID:kaste,项目名称:mockito-python,代码行数:7,代码来源:instancemethods_test.py

示例4: assert_login_setup_service_for_user

 def assert_login_setup_service_for_user(_):
     verify(self.portal).login(ANY(), None, IResource)
     verify(self.services_factory).is_logged_in('some_user_uuid')
     verifyNoMoreInteractions(self.services_factory)
     interstitial_js_in_template = '<script src="startup-assets/Interstitial.js"></script>'
     self.assertIn(interstitial_js_in_template, self.request.written[0])
     self.assertTrue(self.resource.is_logged_in(self.request))
开发者ID:phss,项目名称:pixelated-user-agent,代码行数:7,代码来源:test_login_resource.py

示例5: testVerifies

 def testVerifies(self):
   mockOne, mockTwo = mock(), mock()
   mockOne.foo()
   mockTwo.bar()
   
   verify(mockOne).foo()
   verify(mockTwo).bar()
   verifyNoMoreInteractions(mockOne, mockTwo)    
开发者ID:nyeddi,项目名称:pybuilder_proj,代码行数:8,代码来源:verifications_test.py

示例6: testExpectWitoutVerification

    def testExpectWitoutVerification(self):
        rex = Dog()
        expect(rex).bark('Miau').thenReturn('Wuff')
        verifyNoMoreInteractions(rex)

        rex.bark('Miau')
        with pytest.raises(VerificationError):
            verifyNoMoreInteractions(rex)
开发者ID:kaste,项目名称:mockito-python,代码行数:8,代码来源:instancemethods_test.py

示例7: test_register_synched_should_call_listener_for_each_existent_reference_when_there_is_one_selector

    def test_register_synched_should_call_listener_for_each_existent_reference_when_there_is_one_selector(self):
        reference1 = 'REFERENCE1'
        reference2 = 'REFERENCE2'
        selection = [[reference1, reference2]]

        self.manager.register_synched(self.listener_callable_mock, selection)
        verify(self.listener_mock, times=1).__call__(reference1)
        verify(self.listener_mock, times=1).__call__(reference2)
        verifyNoMoreInteractions(self.listener_mock)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:9,代码来源:tagselection_tests.py

示例8: test_send_mail_does_not_delete_draft_on_error

    def test_send_mail_does_not_delete_draft_on_error(self):
        when(InputMail).from_dict(ANY()).thenReturn('inputmail')

        deferred_failure = defer.fail(Exception("Assume sending mail failed"))
        when(self.mail_sender).sendmail(ANY()).thenReturn(deferred_failure)

        try:
            yield self.mail_service.send_mail({'ident': '12'})
            self.fail("send_mail is expected to raise if underlying call fails")
        except:
            verify(self.mail_sender).sendmail("inputmail")
            verifyNoMoreInteractions(self.drafts)
开发者ID:kalfonso,项目名称:pixelated-user-agent,代码行数:12,代码来源:test_mail_service.py

示例9: test_assign_resources_leaves_current_assignment_state

 def test_assign_resources_leaves_current_assignment_state(self):
     when(self.keystore).keys('assign:*').thenReturn(['assign:A'])
     when(self.keystore).get('assign:A').thenReturn('a')
     when(self.keystore).keys('resource:*').thenReturn(['resource:A'])
     when(self.keystore).get('resource:A').thenReturn(
         (0, 'please-assign', 'address'))
     self.computer.assign_resources(['a'])
     verify(self.keystore).keys('assign:*')
     verify(self.keystore).get('assign:A')
     verify(self.keystore).keys('resource:*')
     verify(self.keystore).get('resource:A')
     verifyNoMoreInteractions(self.keystore)
开发者ID:jrydberg,项目名称:fechter,代码行数:12,代码来源:test_assign.py

示例10: test_waits_for_consensus_on_leader_before_proclaiming

 def test_waits_for_consensus_on_leader_before_proclaiming(self):
     peer = mock()
     when(peer).get(self.election.LEADER_KEY).thenReturn('a')
     when(peer).keys().thenReturn([self.election.LEADER_KEY])
     self.gossiper.live_peers = [peer]
     when(self.gossiper).get(self.election.LEADER_KEY).thenReturn('b')
     self.election.value_changed('peer', self.election.LEADER_KEY, 'a')
     verify(self.gossiper).get(self.election.LEADER_KEY)
     verify(peer).keys()
     verify(peer).get(self.election.LEADER_KEY)
     verifyNoMoreInteractions(self.gossiper)
     verifyNoMoreInteractions(peer)
开发者ID:etiennekruger,项目名称:txgossip,代码行数:12,代码来源:test_leader.py

示例11: test_waits_for_consensus_on_vote_before_leader_elected

 def test_waits_for_consensus_on_vote_before_leader_elected(self):
     peer = mock()
     when(peer).get(self.election.VOTE_KEY).thenReturn('a')
     self.gossiper.live_peers = [peer]
     when(peer).keys().thenReturn([self.election.VOTE_KEY])
     when(self.gossiper).get(self.election.VOTE_KEY).thenReturn('b')
     self.election.value_changed('peer-a', self.election.VOTE_KEY,
                                 'a')
     verify(self.gossiper).get(self.election.VOTE_KEY)
     verify(peer).keys()
     verify(peer).get(self.election.VOTE_KEY)
     verifyNoMoreInteractions(self.gossiper)
     verifyNoMoreInteractions(peer)
开发者ID:etiennekruger,项目名称:txgossip,代码行数:13,代码来源:test_leader.py

示例12: test_leader_elected_when_consensus_reached_on_votes

 def test_leader_elected_when_consensus_reached_on_votes(self):
     peer = mock()
     when(peer).get(self.election.VOTE_KEY).thenReturn('a')
     when(peer).keys().thenReturn([self.election.VOTE_KEY])
     self.gossiper.live_peers = [peer]
     when(self.gossiper).get(self.election.VOTE_KEY).thenReturn('a')
     self.election.value_changed('peer-a', self.election.VOTE_KEY, 'a')
     verify(self.gossiper).get(self.election.VOTE_KEY)
     verify(self.gossiper).set(self.election.LEADER_KEY, 'a')
     verify(peer).keys()
     verify(peer).get(self.election.VOTE_KEY)
     verifyNoMoreInteractions(self.gossiper)
     verifyNoMoreInteractions(peer)
开发者ID:etiennekruger,项目名称:txgossip,代码行数:13,代码来源:test_leader.py

示例13: test_get_should_use_callableFactory_to_populte_resultant_dictiornary

    def test_get_should_use_callableFactory_to_populte_resultant_dictiornary(self):
        self.tag_mappings.update({
                                 'A': set(['a1', 'a2', 'a3'])
                                 })
        when(self.callable_factory).__call__('a1').thenReturn('a1')
        when(self.callable_factory).__call__('a2').thenReturn('a2')
        when(self.callable_factory).__call__('a3').thenReturn('a3')

        self.tagSelection.union('A').get()

        verify(self.callable_factory, times=1).__call__('a1')
        verify(self.callable_factory, times=1).__call__('a2')
        verify(self.callable_factory, times=1).__call__('a3')
        verifyNoMoreInteractions(self.callable_factory)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:14,代码来源:tagselection_tests.py

示例14: test_set_selenium_timeout_only_affects_open_browsers

 def test_set_selenium_timeout_only_affects_open_browsers(self):
     bm = _BrowserManagementKeywords()
     first_browser, second_browser = mock(), mock()
     bm._cache.register(first_browser)
     bm._cache.close()
     verify(first_browser).quit()
     bm._cache.register(second_browser)
     bm.set_selenium_timeout("10 seconds")
     verify(second_browser).set_script_timeout(10.0)
     bm._cache.close_all()
     verify(second_browser).quit()
     bm.set_selenium_timeout("20 seconds")
     verifyNoMoreInteractions(first_browser)
     verifyNoMoreInteractions(second_browser)
开发者ID:Gaurang033,项目名称:Selenium2Library,代码行数:14,代码来源:test_browsermanagement.py

示例15: test_register_should_call_listener_for_late_reference_when_there_is_one_selector

    def test_register_should_call_listener_for_late_reference_when_there_is_one_selector(self):
        reference = 'REFERENCE'

        selection = mock()
        when(selection).__iter__().thenReturn([].__iter__()).thenReturn([reference].__iter__())
        when(selection).is_elegible(reference).thenReturn(True)

        self.manager.register(self.listener_callable_mock, utils.IterableMock(selection))
        verify(self.listener_mock, times=0).__call__(anyx())
        verifyNoMoreInteractions(self.listener_mock)

        self.manager.evaluate_new_candidate(reference)
        verify(self.listener_mock, times=1).__call__(reference)
        verifyNoMoreInteractions(self.listener_mock)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:14,代码来源:tagselection_tests.py


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