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


Python credentials.Credentials类代码示例

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


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

示例1: authenticate

    def authenticate(self):
        if self.authenticated:
            return

        credentials = Credentials(config_urls.bug_server_host, git_prefix="bugzilla")

        attempts = 0
        while not self.authenticated:
            attempts += 1
            username, password = credentials.read_credentials()

            _log.info("Logging in as %s..." % username)
            self.browser.open(config_urls.bug_server_url +
                              "index.cgi?GoAheadAndLogIn=1")
            self.browser.select_form(name="login")
            self.browser['Bugzilla_login'] = username
            self.browser['Bugzilla_password'] = password
            self.browser.find_control("Bugzilla_restrictlogin").items[0].selected = False
            response = self.browser.submit()

            match = re.search("<title>(.+?)</title>", response.read())
            # If the resulting page has a title, and it contains the word
            # "invalid" assume it's the login failure page.
            if match and re.search("Invalid", match.group(1), re.IGNORECASE):
                errorMessage = "Bugzilla login failed: %s" % match.group(1)
                # raise an exception only if this was the last attempt
                if attempts < 5:
                    _log.error(errorMessage)
                else:
                    raise Exception(errorMessage)
            else:
                self.authenticated = True
                self.username = username
开发者ID:chenbk85,项目名称:webkit2-wincairo,代码行数:33,代码来源:bugzilla.py

示例2: test_security_output_parse_entry_not_found

    def test_security_output_parse_entry_not_found(self):
        credentials = Credentials("foo.example.com")
        if not credentials._is_mac_os_x():
            return  # This test does not run on a non-Mac.

        # Note, we ignore the captured output because it is already covered
        # by the test case CredentialsTest._assert_security_call (below).
        outputCapture = OutputCapture()
        outputCapture.capture_output()
        self.assertEqual(credentials._run_security_tool(), None)
        outputCapture.restore_output()
开发者ID:digideskio,项目名称:WebkitAIR,代码行数:11,代码来源:credentials_unittest.py

示例3: test_credentials_from_environment

    def test_credentials_from_environment(self):
        executive_mock = Mock()
        credentials = Credentials("example.com", executive=executive_mock)

        saved_environ = os.environ.copy()
        os.environ['WEBKIT_BUGZILLA_USERNAME'] = "foo"
        os.environ['WEBKIT_BUGZILLA_PASSWORD'] = "bar"
        username, password = credentials._credentials_from_environment()
        self.assertEquals(username, "foo")
        self.assertEquals(password, "bar")
        os.environ = saved_environ
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:11,代码来源:credentials_unittest.py

示例4: test_security_output_parse_entry_not_found

    def test_security_output_parse_entry_not_found(self):
        # FIXME: This test won't work if the user has a credential for foo.example.com!
        credentials = Credentials("foo.example.com")
        if not credentials._is_mac_os_x():
            return  # This test does not run on a non-Mac.

        # Note, we ignore the captured output because it is already covered
        # by the test case CredentialsTest._assert_security_call (below).
        outputCapture = OutputCapture()
        outputCapture.capture_output()
        self.assertIsNone(credentials._run_security_tool("find-internet-password"))
        outputCapture.restore_output()
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:12,代码来源:credentials_unittest.py

示例5: test_security_output_parse

 def test_security_output_parse(self):
     credentials = Credentials("bugs.webkit.org")
     self.assertEqual(
         credentials._parse_security_tool_output(self.example_security_output), ["[email protected]", "SECRETSAUCE"]
     )
开发者ID:digideskio,项目名称:WebkitAIR,代码行数:5,代码来源:credentials_unittest.py

示例6: __init__

 def __init__(self, *args, **kwargs):
     if 'executive' not in kwargs:
         kwargs['executive'] = MockExecutive()
     Credentials.__init__(self, *args, **kwargs)
开发者ID:EQ4,项目名称:h5vcc,代码行数:4,代码来源:credentials_unittest.py


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