本文整理汇总了Python中mockito.inorder.verify函数的典型用法代码示例。如果您正苦于以下问题:Python verify函数的具体用法?Python verify怎么用?Python verify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_schedules_job_with_one_child_one_parent
def test_schedules_job_with_one_child_one_parent(self):
self.workflow_file_content = "JOB A ls ssh://host/dir\n"
self.workflow_file_content += "JOB B rm ssh://host/file\n"
self.workflow_file_content += "PARENT B CHILD A"
self.run_workflow()
inorder.verify(self.filesystem).remove(["ssh://host/file"])
inorder.verify(self.filesystem).list_dir("ssh://host/dir")
示例2: test_update_draft
def test_update_draft(self):
mail = InputMail.from_dict(test_helper.mail_dict())
when(self.mail_store).add_mail("DRAFTS", mail.raw).thenReturn(defer.succeed(LeapMail("id", "DRAFTS")))
self.draft_service.update_draft(mail.ident, mail)
inorder.verify(self.mail_store).add_mail("DRAFTS", mail.raw)
inorder.verify(self.mail_store).delete_mail(mail.ident)
示例3: test_update_draft
def test_update_draft(self):
mail = InputMail.from_dict(test_helper.mail_dict())
when(self.drafts_mailbox).add(mail).thenReturn(mail)
self.draft_service.update_draft(mail.ident, mail)
inorder.verify(self.drafts_mailbox).add(mail)
inorder.verify(self.drafts_mailbox).remove(mail.ident)
示例4: test_canAddCommentsToStoryTicket
def test_canAddCommentsToStoryTicket(self):
tracker = self.makeValidTracker()
trackerInstance = self.trackerInstance_
testing = Testing()
item = self.itemWithComments(testing)
tracker.updateCommentsFor(item)
inorder.verify(trackerInstance).AddComment(testing.issue.GetStoryId(), testing.comment1.text())
inorder.verify(trackerInstance).AddComment(testing.issue.GetStoryId(), testing.comment2.text())
pass
示例5: testPassesMixedVerifications
def testPassesMixedVerifications(self):
self.mock.first()
self.mock.second()
verify(self.mock).first()
verify(self.mock).second()
inorder.verify(self.mock).first()
inorder.verify(self.mock).second()
示例6: test_update_draft
def test_update_draft(self):
mail = InputMail.from_dict(test_helper.mail_dict(), from_address='[email protected]')
when(self.mail_store).delete_mail(mail.ident).thenReturn(defer.succeed(True))
when(self.mail_store).add_mail('DRAFTS', mail.raw).thenReturn(defer.succeed(LeapMail('id', 'DRAFTS')))
self.draft_service.update_draft(mail.ident, mail)
inorder.verify(self.mail_store).delete_mail(mail.ident)
inorder.verify(self.mail_store).add_mail('DRAFTS', mail.raw)
示例7: test_whenSeedingWithRemoteStatusForJira
def test_whenSeedingWithRemoteStatusForJira(self):
ticket = JiraTicket()
statusId = "1234"
closed = "Closed"
ticket.setStatus(statusId)
mapObject = mock()
when(mapObject).translateStatusTo('jiraStatusName', statusId).thenReturn([closed])
status = TrackerItemStatus(ticket, apiObject=mapObject)
status.pivotal()
inorder.verify(mapObject).translateStatusTo('jiraStatusName', statusId)
inorder.verify(mapObject).translateStatusTo('pivotal', closed)
self.assertEqual(status.jira(), [closed])
示例8: 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)
示例9: test_set_data_watcher
def test_set_data_watcher(self):
watcher = mock()
z = pookeeper.allocate(self.hosts)
z.create('/pookie', CREATOR_ALL_ACL, Ephemeral(), data=_random_data())
stat = z.exists('/pookie')
stat = z.set_data('/pookie', _random_data(), stat.version)
z.get_data('/pookie', watcher=watcher)
stat = z.set_data('/pookie', _random_data(), stat.version)
z.get_data('/pookie', watcher=watcher)
z.delete('/pookie', stat.version)
z.close()
inorder.verify(watcher).data_changed('/pookie')
inorder.verify(watcher).node_deleted('/pookie')
verifyNoMoreInteractions(watcher)
示例10: testFailsMixedVerifications
def testFailsMixedVerifications(self):
self.mock.second()
self.mock.first()
# first - normal verifications, they should pass
verify(self.mock).first()
verify(self.mock).second()
# but, inorder verification should fail
self.assertRaises(VerificationError, inorder.verify(self.mock).first)
示例11: test_schedules_job_with_two_children
def test_schedules_job_with_two_children(self):
self.workflow_file_content = "JOB A ls ssh://host/dir\n"
self.workflow_file_content += "JOB B rm ssh://host/file\n"
self.workflow_file_content += "JOB C ls ssh://host/dir2\n"
self.workflow_file_content += "JOB D cat ssh://host/file2\n"
self.workflow_file_content += "PARENT B D CHILD A C\n"
self.workflow_file_content += "PARENT B CHILD D \n"
self.workflow_file_content += "PARENT A CHILD C\n"
self.run_workflow()
inorder.verify(self.filesystem).remove(["ssh://host/file"])
inorder.verify(self.filesystem).cat(["ssh://host/file2"])
inorder.verify(self.filesystem).list_dir("ssh://host/dir")
inorder.verify(self.filesystem).list_dir("ssh://host/dir2")
示例12: test_exists_default_watcher
def test_exists_default_watcher(self):
watcher = mock()
z = pookeeper.allocate(self.hosts, watcher=watcher)
assert not z.exists('/pookie', watch=True)
z.create('/pookie', CREATOR_ALL_ACL, Ephemeral(), data=_random_data())
stat = z.exists('/pookie', watch=True)
stat = z.set_data('/pookie', _random_data(), stat.version)
# This data change will be ignored since the watch has been reset
z.set_data('/pookie', _random_data(), stat.version)
stat = z.exists('/pookie', watch=True)
z.delete('/pookie', stat.version)
z.close()
inorder.verify(watcher).session_connected(matchers.any(long), matchers.any(str), False)
inorder.verify(watcher).node_created('/pookie')
inorder.verify(watcher).data_changed('/pookie')
inorder.verify(watcher).node_deleted('/pookie')
inorder.verify(watcher).connection_closed()
verifyNoMoreInteractions(watcher)
示例13: testPassesIfMultipleInteractions
def testPassesIfMultipleInteractions(self):
self.mock.first()
self.mock.second()
self.mock.third()
inorder.verify(self.mock).first()
inorder.verify(self.mock).second()
inorder.verify(self.mock).third()
示例14: test_print_statement_containing_all_transactions
def test_print_statement_containing_all_transactions(self):
console = mock()
clock = mock()
when(clock).date_as_string().thenReturn('01/04/2015').thenReturn('02/04/2015').thenReturn('10/04/2015')
account = Account(TransactionRepository(clock), StatementPrinter(console))
account.deposit(1000)
account.withdraw(100)
account.deposit(500)
account.print_statement()
inorder.verify(console).print_line('DATE | AMOUNT | BALANCE')
inorder.verify(console).print_line('10/04/2015 | 500.00 | 1400.00')
inorder.verify(console).print_line('02/04/2015 | -100.00 | 900.00')
inorder.verify(console).print_line('01/04/2015 | 1000.00 | 1000.00')
示例15: test_canAddCommentsToTicket
def test_canAddCommentsToTicket(self):
jira = JiraTracker()
jiraInstance = self.getMockFor(jira)
testing = Testing()
item = self.itemWithComments(testing)
jira.updateCommentsFor(item)
inorder.verify(jiraInstance.service).login(any(),any())
inorder.verify(jiraInstance.service).addComment(self.auth_, testing.issue.key, {"body":testing.comment1.text()})
inorder.verify(jiraInstance.service).addComment(self.auth_, testing.issue.key, {"body":testing.comment2.text()})
pass