diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
tree | 73dc228333948738bbe02976cacca8cd382bc978 /Tools/Scripts/webkitpy/common/net/credentials_unittest.py | |
parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Tools/Scripts/webkitpy/common/net/credentials_unittest.py')
-rw-r--r-- | Tools/Scripts/webkitpy/common/net/credentials_unittest.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Tools/Scripts/webkitpy/common/net/credentials_unittest.py b/Tools/Scripts/webkitpy/common/net/credentials_unittest.py index 2ab160c88..a797e3d1b 100644 --- a/Tools/Scripts/webkitpy/common/net/credentials_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/credentials_unittest.py @@ -32,6 +32,7 @@ import unittest from webkitpy.common.net.credentials import Credentials from webkitpy.common.system.executive import Executive from webkitpy.common.system.outputcapture import OutputCapture +from webkitpy.common.system.user_mock import MockUser from webkitpy.thirdparty.mock import Mock from webkitpy.tool.mocktool import MockOptions from webkitpy.common.system.executive_mock import MockExecutive @@ -179,6 +180,33 @@ password: "SECRETSAUCE" # credential source could be affected by the user's environment. self.assertEqual(credentials.read_credentials(), ("test@webkit.org", "NOMNOMNOM")) + def test_keyring_without_git_repo_nor_keychain(self): + class MockKeyring(object): + def get_password(self, host, username): + return "NOMNOMNOM" + + class FakeCredentials(MockedCredentials): + def _credentials_from_keychain(self, username): + return (None, None) + + def _credentials_from_environment(self): + return (None, None) + + class FakeUser(MockUser): + @classmethod + def prompt(cls, message, repeat=1, raw_input=raw_input): + return "test@webkit.org" + + @classmethod + def prompt_password(cls, message, repeat=1, raw_input=raw_input): + raise AssertionError("should not prompt for password") + + with _TemporaryDirectory(suffix="not_a_git_repo") as temp_dir_path: + credentials = FakeCredentials("fake.hostname", cwd=temp_dir_path, keyring=MockKeyring()) + # FIXME: Using read_credentials here seems too broad as higher-priority + # credential source could be affected by the user's environment. + self.assertEqual(credentials.read_credentials(FakeUser), ("test@webkit.org", "NOMNOMNOM")) + if __name__ == '__main__': unittest.main() |