Changeset 84697 in webkit
- Timestamp:
- Apr 22, 2011 3:47:55 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r84692 r84697 1 2011-04-22 Daniel Bates <dbates@webkit.org> 2 3 Reviewed by Csaba Osztrogonác. 4 5 webkit-patch land hangs if svn prompts for credentials 6 https://bugs.webkit.org/show_bug.cgi?id=31500 7 8 Make has_authorization_for_realm() return True only if there exists a credentials file 9 that contains either the word "password" or "passtype". We assume that these words don't 10 coincide with the actual credential data (e.g. a person's username is "password"). 11 12 * Scripts/webkitpy/common/checkout/scm.py: 13 * Scripts/webkitpy/common/checkout/scm_unittest.py: 14 - Added test cases: 15 test_has_authorization_for_realm_using_credentials_with_passtype(), 16 test_has_authorization_for_realm_using_credentials_with_password(), 17 test_not_have_authorization_for_realm_with_credentials_missing_password_and_passtype() 18 - Renamed test_not_have_authorization_for_realm() to test_not_have_authorization_for_realm_when_missing_credentials_file() 19 to better describe what it's testing. 20 - Repurposed test_has_authorization_for_realm() to take realm and credential data to use 21 and return the result of calling has_authorization_for_realm() so that the caller can 22 assert the result; Renamed to _test_has_authorization_for_realm_using_credentials() to 23 better reflect its new purpose. 24 1 25 2011-04-22 Adam Barth <abarth@webkit.org> 2 26 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm.py
r84114 r84697 329 329 find_args = ["find", ".subversion", "-type", "f", "-exec", "grep", "-q", realm, "{}", ";", "-print"] 330 330 find_output = self.run(find_args, cwd=home_directory, error_handler=Executive.ignore_error).rstrip() 331 return find_output and os.path.isfile(os.path.join(home_directory, find_output)) 331 if not find_output or not os.path.isfile(os.path.join(home_directory, find_output)): 332 return False 333 # Subversion either stores the password in the credential file, indicated by the presence of the key "password", 334 # or uses the system password store (e.g. Keychain on Mac OS X) as indicated by the presence of the key "passtype". 335 # We assume that these keys will not coincide with the actual credential data (e.g. that a person's username 336 # isn't "password") so that we can use grep. 337 if self.run(["grep", "password", find_output], cwd=home_directory, return_exit_code=True) == 0: 338 return True 339 return self.run(["grep", "passtype", find_output], cwd=home_directory, return_exit_code=True) == 0 332 340 333 341 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
r84114 r84697 1 1 # Copyright (C) 2009 Google Inc. All rights reserved. 2 2 # Copyright (C) 2009 Apple Inc. All rights reserved. 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. 3 4 # 4 5 # Redistribution and use in source and binary forms, with or without … … 668 669 self.assertRaises(AuthenticationError, self._shared_test_commit_with_message) 669 670 670 def test_has_authorization_for_realm(self): 671 def test_has_authorization_for_realm_using_credentials_with_passtype(self): 672 credentials = """ 673 K 8 674 passtype 675 V 8 676 keychain 677 K 15 678 svn:realmstring 679 V 39 680 <http://svn.webkit.org:80> Mac OS Forge 681 K 8 682 username 683 V 17 684 dbates@webkit.org 685 END 686 """ 687 self.assertTrue(self._test_has_authorization_for_realm_using_credentials(SVN.svn_server_realm, credentials)) 688 689 def test_has_authorization_for_realm_using_credentials_with_password(self): 690 credentials = """ 691 K 15 692 svn:realmstring 693 V 39 694 <http://svn.webkit.org:80> Mac OS Forge 695 K 8 696 username 697 V 17 698 dbates@webkit.org 699 K 8 700 password 701 V 4 702 blah 703 END 704 """ 705 self.assertTrue(self._test_has_authorization_for_realm_using_credentials(SVN.svn_server_realm, credentials)) 706 707 def _test_has_authorization_for_realm_using_credentials(self, realm, credentials): 671 708 scm = detect_scm_system(self.svn_checkout_path) 672 709 fake_home_dir = tempfile.mkdtemp(suffix="fake_home_dir") … … 674 711 os.mkdir(svn_config_dir_path) 675 712 fake_webkit_auth_file = os.path.join(svn_config_dir_path, "fake_webkit_auth_file") 676 write_into_file_at_path(fake_webkit_auth_file, SVN.svn_server_realm)677 self.assertTrue(scm.has_authorization_for_realm(SVN.svn_server_realm, home_directory=fake_home_dir))713 write_into_file_at_path(fake_webkit_auth_file, credentials) 714 result = scm.has_authorization_for_realm(realm, home_directory=fake_home_dir) 678 715 os.remove(fake_webkit_auth_file) 679 716 os.rmdir(svn_config_dir_path) 680 717 os.rmdir(fake_home_dir) 681 682 def test_not_have_authorization_for_realm(self): 718 return result 719 720 def test_not_have_authorization_for_realm_with_credentials_missing_password_and_passtype(self): 721 credentials = """ 722 K 15 723 svn:realmstring 724 V 39 725 <http://svn.webkit.org:80> Mac OS Forge 726 K 8 727 username 728 V 17 729 dbates@webkit.org 730 END 731 """ 732 self.assertFalse(self._test_has_authorization_for_realm_using_credentials(SVN.svn_server_realm, credentials)) 733 734 def test_not_have_authorization_for_realm_when_missing_credentials_file(self): 683 735 scm = detect_scm_system(self.svn_checkout_path) 684 736 fake_home_dir = tempfile.mkdtemp(suffix="fake_home_dir")
Note: See TracChangeset
for help on using the changeset viewer.