本文整理汇总了Python中mockito.mockito.verify函数的典型用法代码示例。如果您正苦于以下问题:Python verify函数的具体用法?Python verify怎么用?Python verify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_onlyTakeCommentsFromIssueForByFilter
def test_onlyTakeCommentsFromIssueForByFilter(self):
toTracker = mock()
aTestItemFilter = mock()
syncCommentsFor = TrackerSyncBy.syncingItem(aTestItemFilter.calledWith)
when(toTracker).items(None).thenRaise(StopIteration)
syncCommentsFor(None, toTracker)
verify(aTestItemFilter).calledWith(None)
示例2: test_doNotSyncIfItemIsLessUpToDate
def test_doNotSyncIfItemIsLessUpToDate(self):
toTracker, itemToSyncTo, itemToSyncFrom, syncCommentsFor = self.setupSync()
when(itemToSyncTo).updatedAt().thenReturn(1)
when(itemToSyncFrom).updatedAt().thenReturn(0)
when(itemToSyncTo).canBeSyncedWith(itemToSyncFrom).thenReturn(True)
syncCommentsFor(itemToSyncFrom, toTracker)
verify(toTracker, never).update(itemToSyncTo)
示例3: test_get_children_watcher
def test_get_children_watcher(self):
watcher = mock()
z = pookeeper.allocate(self.hosts)
z.create('/pookie', CREATOR_ALL_ACL, Persistent(), data=_random_data())
z.get_children('/pookie', watcher=watcher)
z.create('/pookie/bear', CREATOR_ALL_ACL, Persistent(), data=_random_data())
z.get_children('/pookie', watcher=watcher)
z.set_data('/pookie', _random_data())
z.set_data('/pookie/bear', _random_data())
# One is for when we do and the other is for when we don't chroot
z.get_children('/pookie', watcher=watcher)
z.get_children('/pookie/bear', watcher=watcher)
z.delete('/pookie/bear')
z.delete('/pookie')
z.close()
mockito.verify(watcher, times=2).children_changed('/pookie')
mockito.verify(watcher).node_deleted('/pookie/bear')
verifyNoMoreInteractions(watcher)
示例4: test_doNotAddCommentsWhenItemNotFound
def test_doNotAddCommentsWhenItemNotFound(self):
toTracker = mock()
item = mock()
syncCommentsFor = TrackerSyncBy.syncingItem()
when(toTracker).items(None).thenRaise(StopIteration)
syncCommentsFor(item, toTracker)
verify(toTracker, never).update(item)
示例5: testFeedback
def testFeedback(self):
bmlToIpaaca = BMLRealizerToIpaacaAdapter()
ipaacaToBML = IpaacaToBMLRealizerAdapter(self.mockRealizerPort)
bmlToIpaaca.addListeners(self.mockFeedbackListener);
ipaacaToBML.feedback("bmlfeedback");
time.sleep(0.05)
verify(self.mockFeedbackListener).feedback("bmlfeedback");
示例6: testFeedbackOtherCharacter
def testFeedbackOtherCharacter(self):
bmlToIpaaca = BMLRealizerToIpaacaAdapter("Fred")
ipaacaToBML = IpaacaToBMLRealizerAdapter(self.mockRealizerPort,"Wilma")
bmlToIpaaca.addListeners(self.mockFeedbackListener);
ipaacaToBML.feedback("bmlfeedback");
time.sleep(0.05)
verify(self.mockFeedbackListener,times=0).feedback("bmlfeedback");
示例7: test_whenJiraIdIsZeroNameIsNone
def test_whenJiraIdIsZeroNameIsNone(self):
jiraStatus = mock()
mapObject = mock()
when(jiraStatus).status().thenReturn("")
status = TrackerItemStatus(jiraStatus, mapObject)
verify(mapObject, never).translateStatusTo(any(), any())
self.assertEqual(status.jira(), None)
示例8: test_whenSeedingWithPivotalStatus
def test_whenSeedingWithPivotalStatus(self):
pivotalStatus = "Started"
mapObject = mock()
status = TrackerItemStatus(pivotalStatus, apiObject=mapObject)
status.jira()
verify(mapObject).translateStatusTo('jira', pivotalStatus)
self.assertEqual(status.pivotal(), pivotalStatus)
示例9: test_cleanup_quits_webdrivers
def test_cleanup_quits_webdrivers(self):
"Tests that clean up is performed on webdrivers created by WebdriverManger"
config_reader = mock(ConfigReader)
when(config_reader).get(
WebDriverManager.SHUTDOWN_HOOK_CONFIG, True).thenReturn(True)
when(config_reader).get(
WebDriverManager.REUSE_BROWSER, True).thenReturn(False)
when(config_reader).get(
WebDriverManager.REUSE_BROWSER, True).thenReturn(False)
when(config_reader).get(
WebDriverManager.ENABLE_THREADING_SUPPORT, False).thenReturn(True)
webdriver_mock1 = mock(WebDriver)
webdriverfactory_mock = mock(WebDriverFactory)
when(webdriverfactory_mock).create_webdriver(
testname=None).thenReturn(webdriver_mock1)
webdriver_provider = WebDriverManager(webdriver_factory=webdriverfactory_mock,
config=config_reader)
# Spawn thread to check if driver is unique per thread.
driver = webdriver_provider.get_driver()
del webdriver_provider
# verify decontructor cleans up the webdriver.
verify(driver).quit()
示例10: test_doNotAddItemWhenNoItemToAdd
def test_doNotAddItemWhenNoItemToAdd(self):
toTracker = mock()
fromTracker = mock()
when(fromTracker).items(any()).thenReturn([])
syncByAddingItems = TrackerSyncBy.addingItemsOfType(None)
syncByAddingItems(fromTracker, toTracker)
verify(toTracker, never).update()
示例11: test_CanRetrieveDevicesListFiltered
def test_CanRetrieveDevicesListFiltered():
pertinoSdk, _, response = setupSdk()
json = {"devices": [{"ipv4Address": "123.456.789.10", "hostName": "host", "id": 1234}]}
when(response).json().thenReturn(json)
closure = mock()
pertinoSdk.listDevicesIn({"id":1}, closure.function)
verify(closure).function(json["devices"][0])
示例12: test_user_can_login_with_password
def test_user_can_login_with_password(self):
cli = mock()
user = User("username", "password", cli)
when(cli).compareReceivedAgainst(any(),any(), indexOfSuccessfulResult=any()).thenReturn(0).thenReturn(1)
user.login()
verify(cli).send("su username")
verify(cli).send("password")
示例13: test_retryWhenTryingToGetStoriesAndException
def test_retryWhenTryingToGetStoriesAndException(self):
tracker = self.makeValidTracker()
trackerInstance = self.trackerInstance_
when(trackerInstance).GetStories(any()).thenRaise(Exception("")).thenReturn([Story(),Story()])
when(trackerInstance).GetComments(any()).thenReturn([])
next(tracker.items())
verify(trackerInstance, times=2).GetStories(any())
示例14: test_filterIsSentWhenSpecified
def test_filterIsSentWhenSpecified(self):
jira = JiraTracker()
jiraInstance = self.getMockFor(jira)
forFilter = "blah"
self.setMocksForGettingItems(jiraInstance)
self.assertRaises(StopIteration, next, jira._getItems(forFilter))
verify(jiraInstance.service).getIssuesFromJqlSearch(any(),forFilter,any())
示例15: test_mode_exited
def test_mode_exited(self):
cli = self.makeCli()
when(cli).compareReceivedAgainst(any(),any()).thenReturn(0)
testMode = Mode(cli)
testMode.exit()
verify(cli).exitMode(testMode)
verify(cli).send("exit")