• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python matchers.any函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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())
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:7,代码来源:jiratracker_test.py


示例2: test_multithreadMode

    def test_multithreadMode(self):
        """
        Tests that when we call get_driver() it returns a unique driver for each thread,
        but for the same thread returns the same driver.
        """
        config_reader = mock(ConfigReader)
        when(config_reader).get(WebDriverManager.SHUTDOWN_HOOK_CONFIG, any()).thenReturn(True)
        when(config_reader).get(WebDriverManager.REUSE_BROWSER, any()).thenReturn(False)
        when(config_reader).get(WebDriverManager.REUSE_BROWSER, any()).thenReturn(False)
        when(config_reader).get(WebDriverManager.ENABLE_THREADING_SUPPORT, any()).thenReturn(True)

        webdriverfactory_mock = mock(WebDriverFactory)
        when(webdriverfactory_mock).create_webdriver(testname=None).thenReturn(mock(WebDriver))\
        .thenReturn(mock(WebDriver)).thenReturn(mock(WebDriver))

        webdriver_provider = WebDriverManager(webdriver_factory=webdriverfactory_mock, 
                                              config = config_reader)

        # Spawn thread to check if driver is unique per thread.
        driver1 = webdriver_provider.get_driver()
        t = threading.Thread(target=lambda: self.__multithreaded_7est_thread2(driver1, webdriver_provider))
        t.start()
        t.join()
        self.assertFalse(self._driver_from_thread_is_same)
        
        # Check that driver is same for the same thread.
        driver3 = webdriver_provider.get_driver()
        self.assertEqual(driver1, driver3, "Same thread should return same driver.")
开发者ID:Hellspam,项目名称:wtframework,代码行数:28,代码来源:test_webdriver_manager.py


示例3: 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)
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:7,代码来源:trackeritemstatus_test.py


示例4: test_roger_push_env_from_ROGER_ENV_VAR

    def test_roger_push_env_from_ROGER_ENV_VAR(self):
        settings = mock(Settings)
        appConfig = mock(AppConfig)
        roger_push = RogerPush()
        marathon = mock(Marathon)
        mockedHooks = mock(Hooks)
        roger_env = self.roger_env
        config = self.config
        frameworkUtils = mock(FrameworkUtils)
        when(settings).getConfigDir().thenReturn(self.configs_dir)
        when(mockedHooks).run_hook(any(), any(), any()).thenReturn(0)
        when(appConfig).getRogerEnv(self.configs_dir).thenReturn(roger_env)
        when(appConfig).getConfig(any(), any()).thenReturn(config)

        args = self.args
        args.env = None
        args.secrets_file = ""
        args.skip_push = True
        args.app_name = 'grafana_test_app'
        args.config_file = 'test.json'

        roger_env = appConfig.getRogerEnv(self.configs_dir)
        roger_env["default_environment"] = None
        # Setting ROGER_ENV to specific value
        os.environ["ROGER_ENV"] = "test_env"

        with self.assertRaises(ValueError):
            roger_push.main(settings, appConfig,
                            frameworkUtils, mockedHooks, args)
开发者ID:vmahedia,项目名称:roger-mesos-tools,代码行数:29,代码来源:test_roger_push.py


示例5: test_noDeletionsWhenNoItems

 def test_noDeletionsWhenNoItems(self):
     tracker = self.makeValidTracker()
     trackerInstance = self.trackerInstance_
     when(trackerInstance).GetStories(any()).thenReturn([])
     tracker.deleteAllItems()
     verify(trackerInstance, never).DeleteStory(any())
     pass
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:7,代码来源:pivotaltracker_test.py


示例6: 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())
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:7,代码来源:pivotaltracker_test.py


示例7: test_get_children_default_watcher

    def test_get_children_default_watcher(self):
        watcher = mock()
        z = pookeeper.allocate(self.hosts, watcher=watcher)

        z.create('/pookie', CREATOR_ALL_ACL, Persistent(), data=_random_data())
        z.get_children('/pookie', watch=True)

        z.create('/pookie/bear', CREATOR_ALL_ACL, Persistent(), data=_random_data())
        z.get_children('/pookie', watch=True)

        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', watch=True)
        z.get_children('/pookie/bear', watch=True)

        z.delete('/pookie/bear')
        z.delete('/pookie')

        z.close()

        mockito.verify(watcher).session_connected(matchers.any(long), matchers.any(str), False)
        mockito.verify(watcher, times=2).children_changed('/pookie')
        mockito.verify(watcher).node_deleted('/pookie/bear')
        mockito.verify(watcher).connection_closed()
        verifyNoMoreInteractions(watcher)
开发者ID:maguro,项目名称:pookeeper,代码行数:27,代码来源:test_client.py


示例8: 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")
开发者ID:Pertino,项目名称:dynamic_machine,代码行数:7,代码来源:cli_commands_test.py


示例9: 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")
开发者ID:Pertino,项目名称:dynamic_machine,代码行数:7,代码来源:cli_commands_test.py


示例10: test_updateAddsNewComments

 def test_updateAddsNewComments(self):
     jira = JiraTracker()
     jiraInstance = self.getMockFor(jira)
     testing = Testing()
     item = self.itemWithComments(testing)
     jira.update(item)
     verify(jiraInstance.service, times=2).addComment(any(), any(), any())
     pass
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:jiratracker_test.py


示例11: test_noDeletionsWhenNoItems

 def test_noDeletionsWhenNoItems(self):
     jira = JiraTracker()
     jiraInstance = self.getMockFor(jira)
     jira.selectProject(["",""])
     self.setMocksForGettingItems(jiraInstance)
     jira.deleteAllItems()
     verify(jiraInstance.service, never).deleteIssue(any(), any())
     pass
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:jiratracker_test.py


示例12: test_authSentWhenGettingBugs

 def test_authSentWhenGettingBugs(self):
     jira = JiraTracker()
     jiraInstance = self.getMockFor(jira)
     self.setMocksForGettingItems(jiraInstance)
     itemIterator = jira._getItems()
     self.assertRaises(StopIteration, next, itemIterator)
     verify(jiraInstance.service).getIssuesFromJqlSearch(self.auth_, any(), any())
     pass
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:jiratracker_test.py


示例13: test_canUpdateStatus

 def test_canUpdateStatus(self):
     statusId = "Match"
     action = TestAction(5,statusId)
     jira, jiraInstance, itemId, trackerItem, status = self.setupStatus()
     when(status).jira().thenReturn(statusId)
     when(jiraInstance.service).getAvailableActions(any(), any()).thenReturn([action,])
     jira._ticketWithUpdatedStatusFrom(trackerItem)
     verify(jiraInstance.service).progressWorkflowAction(self.auth_, itemId, action.id, any())
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:jiratracker_test.py


示例14: test_run_hook_returns_zero_when_hook_succeeds

    def test_run_hook_returns_zero_when_hook_succeeds(self):

        when(self.hooks.whobj).invoke_webhook(any(), any(), any()).thenReturn()
        sc = mock(StatsClient)
        when(sc).timing(any(), any()).thenReturn(any())
        when(self.hooks.utils).getStatsClient().thenReturn(sc)
        when(self.hooks.utils).get_identifier(any(), any(), any()).thenReturn(any())
        assert self.hooks.run_hook("pre-build", self.appdata, os.getcwd(), "roger-tools.pre-build-test") == 0
开发者ID:vmahedia,项目名称:roger-mesos-tools,代码行数:8,代码来源:test_hooks.py


示例15: test_whenDoingPivotalOperationAuthenticationIsIncluded

 def test_whenDoingPivotalOperationAuthenticationIsIncluded(self):
     tracker = self.makeTestTracker()
     pivotalApiObject = self.apiObject_
     password = "pass"
     authentication = mock()
     when(pivotalApiObject).HostedTrackerAuth(any(),any()).thenReturn(authentication)
     tracker.withCredential(password)
     verify(pivotalApiObject).Tracker(any(), authentication)
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:pivotaltracker_test.py


示例16: test_canntGetBugsForProject

 def test_canntGetBugsForProject(self):
     jira = JiraTracker()
     jiraInstance = self.getMockFor(jira)
     jira.selectProject(["",""])
     fault = Holder()
     fault.faultstring = ""
     when(jiraInstance.service).getIssuesFromJqlSearch(any(), any(), any()).thenRaise(WebFault(fault, None))
     self.assertRaises(StopIteration, next, jira._getItems())
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:jiratracker_test.py


示例17: test_doNotAddCommentsGreaterThan20000Characters

 def test_doNotAddCommentsGreaterThan20000Characters(self):
     tracker = self.makeValidTracker()
     trackerInstance = self.trackerInstance_
     testing = Testing()
     item = self.itemWithComments(testing)
     item.addComment(Testing.stringOfAsOfSize(20002))
     tracker.updateCommentsFor(item)
     verify(trackerInstance, times=2).AddComment(any(), any())
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:pivotaltracker_test.py


示例18: test_filterIsSentWhenSpecified

 def test_filterIsSentWhenSpecified(self):
     tracker = self.makeValidTracker()
     trackerInstance = self.trackerInstance_
     forFilter = "blah"
     when(trackerInstance).GetStories(any()).thenReturn([])
     when(trackerInstance).GetComments(any()).thenReturn([])
     self.assertRaises(StopIteration, next, tracker.items(forFilter)) 
     verify(trackerInstance).GetStories(forFilter)
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:8,代码来源:pivotaltracker_test.py


示例19: test_run_hook_returns_non_zero_when_hook_fails

    def test_run_hook_returns_non_zero_when_hook_fails(self):

        when(self.hooks.whobj).invoke_webhook(any(), any(), any()).thenReturn()
        sc = mock(StatsClient)
        when(sc).timing(any(), any()).thenReturn(any())
        when(self.hooks.utils).getStatsClient().thenReturn(sc)
        when(self.hooks.utils).get_identifier(any(), any(), any()).thenReturn(any())
        assert self.hooks.run_hook(
            "bad-hook-cmd", self.appdata, os.getcwd(), "roger-tools.bad-hook-cmd-test") != 0
开发者ID:vmahedia,项目名称:roger-mesos-tools,代码行数:9,代码来源:test_hooks.py


示例20: makeValidTracker

 def makeValidTracker(self):
     tracker = self.makeTestTracker()
     pivotalApiObject = self.apiObject_
     trackerInstance = mock()
     when(pivotalApiObject).Tracker(any(),any()).thenReturn(trackerInstance)
     pivotalProjectNumber = 0
     tracker.selectProject(pivotalProjectNumber)
     self.trackerInstance_ = trackerInstance
     return tracker
开发者ID:lwoydziak,项目名称:pivotal-tracker-syncing,代码行数:9,代码来源:pivotaltracker_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mocking.mock函数代码示例发布时间:2022-05-27
下一篇:
Python inorder.verify函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap