本文整理汇总了Python中mockito.verifyNoMoreInteractions函数的典型用法代码示例。如果您正苦于以下问题:Python verifyNoMoreInteractions函数的具体用法?Python verifyNoMoreInteractions怎么用?Python verifyNoMoreInteractions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verifyNoMoreInteractions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: verify
def test_register_should_call_listener_for_each_existent_combination_of_references_when_there_are_multiple_selectors(self):
reference1a = 'REFERENCE1a'
reference2a = 'REFERENCE2a'
selection_a = [reference1a, reference2a]
reference1b = 'REFERENCE1b'
reference2b = 'REFERENCE2b'
selection_b = [reference1b, reference2b]
self.manager.register(self.listener_callable_mock, selection_a, selection_b)
verify(self.listener_mock, times=1).__call__(reference1a, reference1b)
verify(self.listener_mock, times=1).__call__(reference1a, reference2b)
verify(self.listener_mock, times=1).__call__(reference2a, reference1b)
verify(self.listener_mock, times=1).__call__(reference2a, reference2b)
verifyNoMoreInteractions(self.listener_mock)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:15,代码来源:tagselection_tests.py
示例17: test_set_selenium_timeout_only_affects_open_browsers
def test_set_selenium_timeout_only_affects_open_browsers(self):
ctx = mock()
ctx.timeout = 5.0
_drivers = mock()
ctx._drivers = _drivers
first_browser, second_browser = mock(), mock()
ctx._drivers.active_drivers = [first_browser, second_browser]
bm = BrowserManagementKeywords(ctx)
bm.set_selenium_timeout("10 seconds")
verify(first_browser).set_script_timeout(10.0)
verify(second_browser).set_script_timeout(10.0)
ctx._drivers.active_drivers = []
bm.set_selenium_timeout("20 seconds")
verifyNoMoreInteractions(first_browser)
verifyNoMoreInteractions(second_browser)
unstub()
开发者ID:HelioGuilherme66,项目名称:robotframework-selenium2library,代码行数:16,代码来源:test_browsermanagement.py
示例18: test_secure_with_mycnf_error
def test_secure_with_mycnf_error(self):
mock_conn = mock_sql_connection()
when(mock_conn).execute(any()).thenReturn(None)
when(utils).execute_with_timeout("sudo", any(str), "stop").thenReturn(None)
# skip writing the file for now
when(os.path).isfile(any()).thenReturn(False)
mock_status = mock()
when(mock_status).wait_for_real_status_to_change_to(any(), any(), any()).thenReturn(True)
app = MySqlApp(mock_status)
self.assertRaises(TypeError, app.secure, None)
verify(mock_conn, atleast=2).execute(any())
inorder.verify(mock_status).wait_for_real_status_to_change_to(
rd_instance.ServiceStatuses.SHUTDOWN, any(), any()
)
verifyNoMoreInteractions(mock_status)
开发者ID:ReVolly,项目名称:trove,代码行数:17,代码来源:test_dbaas.py
示例19: test_set_selenium_timeout_only_affects_open_browsers
def test_set_selenium_timeout_only_affects_open_browsers(self):
ctx = mock()
ctx.timeout = 5.0
_browsers = mock()
ctx._browsers = _browsers
first_browser, second_browser = mock(), mock()
when(_browsers).get_open_browsers().thenReturn(
[first_browser, second_browser]
)
bm = BrowserManagementKeywords(ctx)
bm.set_selenium_timeout("10 seconds")
verify(first_browser).set_script_timeout(10.0)
verify(second_browser).set_script_timeout(10.0)
when(_browsers).get_open_browsers().thenReturn(
[]
)
bm.set_selenium_timeout("20 seconds")
verifyNoMoreInteractions(first_browser)
verifyNoMoreInteractions(second_browser)
unstub()
开发者ID:ponkar,项目名称:robotframework-selenium2library,代码行数:20,代码来源:test_browsermanagement.py
示例20: mock
def test_register_should_call_listener_for_each_late_combination_of_references_when_there_are_multiple_selectors(self):
reference1a = 'REFERENCE1a'
reference2a = 'REFERENCE2a'
reference1b = 'REFERENCE1b'
reference2b = 'REFERENCE2b'
selection_a = mock()
(when(selection_a).__iter__()
.thenReturn([reference1a].__iter__())
.thenReturn([reference1a, reference2a].__iter__())
.thenReturn([reference1a, reference2a].__iter__()))
when(selection_a).is_elegible(reference2a).thenReturn(True)
selection_b = mock()
(when(selection_b).__iter__()
.thenReturn([reference1b].__iter__())
.thenReturn([reference1b].__iter__())
.thenReturn([reference1b, reference2b].__iter__()))
when(selection_b).is_elegible(reference2b).thenReturn(True)
self.manager.register(self.listener_callable_mock, utils.IterableMock(selection_a), utils.IterableMock(selection_b))
verify(self.listener_mock, times=1).__call__(reference1a, reference1b)
verifyNoMoreInteractions(self.listener_mock)
self.manager.evaluate_new_candidate(reference2a)
verify(self.listener_mock, times=1).__call__(reference2a, reference1b)
verifyNoMoreInteractions(self.listener_mock)
self.manager.evaluate_new_candidate(reference2b)
verify(self.listener_mock, times=1).__call__(reference1a, reference2b)
verify(self.listener_mock, times=1).__call__(reference2a, reference2b)
verifyNoMoreInteractions(self.listener_mock)
开发者ID:rhlobo,项目名称:bigtempo,代码行数:32,代码来源:tagselection_tests.py
注:本文中的mockito.verifyNoMoreInteractions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论