[PATCH] AuthenticationConfig patch to provide expected keys to credential store plug-ins

Jean-Francois Roy bahamut at macstorm.org
Fri Mar 13 03:54:24 GMT 2009


Combined the AuthenticationConfig credentials keys and new netrc  
crendential store plug-in test patches into one.

On Mar 12, 2009, at 16:35, Vincent Ladeuil wrote:

<snip/>

>   jfroy> I think it's fine to delete the keys. They're not required  
> past
>   jfroy> the  decode password key and keeping them around would only
>   jfroy> increase memory  usage.
>
> Memory usage is not a concern here, credentials are used only once  
> for a
> given connection and there is rarely more than one for a given bzr
> command (or even any usage of bzrlib) and they will not last long in  
> the
> call stack anyway since they are of no use (yet) as soon the  
> password is
> consumed.
>
> Yet, the day we'll implement a save mechanism, the deleted keys will  
> be
> needed, so better left them in and update the doc string.

Done.

<snip/>

>   jfroy> === modified file 'bzrlib/plugins/netrc_credential_store/ 
> tests/test_netrc.py'
>   jfroy> --- bzrlib/plugins/netrc_credential_store/tests/ 
> test_netrc.py	2008-10-06 10:06:53 +0000
>   jfroy> +++ bzrlib/plugins/netrc_credential_store/tests/ 
> test_netrc.py	2009-03-10 18:21:20 +0000
>   jfroy> @@ -46,26 +46,53 @@
>   jfroy>              f.write(netrc_content)
>   jfroy>          finally:
>   jfroy>              f.close()
>   jfroy> +
>   jfroy> +        # Create a test AuthenticationConfig object
>   jfroy> +        ac_content = """
>   jfroy> +[host1]
>   jfroy> +host = host
>   jfroy> +user = joe
>   jfroy> +password_encoding = netrc
>   jfroy> +
>   jfroy> +[host2]
>   jfroy> +host = host
>   jfroy> +user = jim
>   jfroy> +password_encoding = netrc
>   jfroy> +
>   jfroy> +[other]
>   jfroy> +host = other
>   jfroy> +user = anonymous
>   jfroy> +password_encoding = netrc
>   jfroy> +"""
>
> This is rather confusing, all tests were standing on their own before
> your patch, now a lot of information is centralized here which reduce
> their defect localization (i.e. an update here may make several tests
> fail).
>
> That's one reason why I asked for a single test checking the  
> additional
> layer.
>
> Another is that it will make your match smaller and easier to review.

Done

>
>   jfroy> +        ac_path = osutils.pathjoin(self.test_home_dir,
>   jfroy> +        'netrc-authentication.conf')
>
>   jfroy> +        f = open(ac_path, 'wb')
>   jfroy> +        try:
>   jfroy> +            f.write(ac_content)
>   jfroy> +        finally:
>   jfroy> +            f.close()
>   jfroy> +        self.ac = config.AuthenticationConfig(_file=ac_path)
>
> _file can be a StringIO(ac_content), no need to create a real file  
> here.

Done.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: authconfig-provider-fix-4.patch
Type: application/octet-stream
Size: 17666 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090312/cf61c033/attachment-0001.obj 


More information about the bazaar mailing list