[PATCH] AuthenticationConfig patch to provide expected keys to credential store plug-ins
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Mar 13 04:18:13 GMT 2009
jfroy> Combined the AuthenticationConfig credentials keys and new netrc
jfroy> crendential store plug-in test patches into one.
BB:approve
The following are cosmetics (faster patched than said :) than can be
applied when merging.
I'll merge that patch myself once someone else approve it.
Vincent
=== modified file 'bzrlib/plugins/netrc_credential_store/tests/test_netrc.py'
--- bzrlib/plugins/netrc_credential_store/tests/test_netrc.py 2009-03-13 03:00:33 +0000
+++ bzrlib/plugins/netrc_credential_store/tests/test_netrc.py 2009-03-13 04:08:23 +0000
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from StringIO import StringIO
+from cStringIO import StringIO
from bzrlib import (
config,
@@ -48,15 +48,6 @@
f.write(netrc_content)
finally:
f.close()
-
- # Create a test AuthenticationConfig object
- ac_content = """
-[host1]
-host = host
-user = joe
-password_encoding = netrc
-"""
- self.ac = config.AuthenticationConfig(_file=StringIO(ac_content))
def _get_netrc_cs(self):
return config.credential_store_registry.get_credential_store('netrc')
@@ -80,8 +71,16 @@
cs = self._get_netrc_cs()
password = cs.decode_password(dict(host='other'))
self.assertIs(None, password)
-
- def test_get_credentials(self):
- credentials = self.ac.get_credentials('scheme', 'host', user='joe')
+
+ def test_get_netrc_credentials_via_auth_config(self):
+ # Create a test AuthenticationConfig object
+ ac_content = """
+[host1]
+host = host
+user = joe
+password_encoding = netrc
+"""
+ conf = config.AuthenticationConfig(_file=StringIO(ac_content))
+ credentials = conf.get_credentials('scheme', 'host', user='joe')
self.assertIsNot(None, credentials)
self.assertEquals('secret', credentials.get('password', None))
More information about the bazaar
mailing list