Senthil Kumaran S wrote on Tue, 1 Jul 2008 at 17:06 +0530:
> Daniel Shahaf wrote:
> > Can you write a regression test?
>
> I am attaching a test case in order to test this issue. Would like to get your
> comments before I commit.
>
Sure.
> [[[
> Test case for issue #2242 - auth cache picking up password from wrong
> username entry.
>
> * subversion/tests/cmdline/basic_tests.py
> (def basic_auth_test): New test.
^
s/def basic_auth_test/basic_auth_test/
> (test_list): Add above test.
>
> Patch by: stylesen
> ]]]
>
>
> Index: subversion/tests/cmdline/basic_tests.py
> ===================================================================
> --- subversion/tests/cmdline/basic_tests.py (revision 31937)
> +++ subversion/tests/cmdline/basic_tests.py (working copy)
> @@ -2355,6 +2355,40 @@
> expected_output, [], 'ls', '-r3',
> '^//A/@3', iota_url)
>
> +
> +# Issue 2242, auth cache picking up password from wrong username entry
> +def basic_auth_test(sbox):
> + "basic auth test"
> +
> + sbox.build(read_only = True)
Creates a working copy.
> + wc_dir = sbox.wc_dir
> +
> + # Checkout with jrandom
> + exit_code, output, errput = svntest.main.run_command(
> + svntest.main.svn_binary, None, 1, 'co', sbox.repo_url, wc_dir,
> + '--username', 'jrandom', '--password', 'rayjandom')
> +
Tries to checkout onto existing working copy. It happens to work, but
I'm not sure that we guarantee that 'checkout' will behave as 'update'
if its target already exists. In which case, we need s/checkout/update/
here.
Though, actually, you can do without a working copy for this test, e.g.
by doing s/checkout $URL/info $URL/.
> + exit_code, output, errput = svntest.main.run_command(
> + svntest.main.svn_binary, None, 1, 'co', sbox.repo_url, wc_dir,
> + '--username', 'jrandom', '--non-interactive')
> +
We need --config-dir here or we would be affected by the user's
~/.subversion/, right? (where, possibly, the creds from a previous run of
the test are cached, etc.)
> + # Checkout with jconstant
> + exit_code, output, errput = svntest.main.run_command(
> + svntest.main.svn_binary, None, 1, 'co', sbox.repo_url, wc_dir,
> + '--username', 'jconstant', '--password', 'rayjandom')
> +
Why aren't you passing --non-interactive? Is it due to the plaintext
passwords logic?
if (svn_cstring_casecmp(store_plaintext_passwords,
SVN_CONFIG_ASK) == 0)
{
if (non_interactive)
/* In non-interactive mode, the default behaviour is
* to not store the password, because it is usually
* passed on the command line. */
may_save_password = FALSE;
> + exit_code, output, errput = svntest.main.run_command(
> + svntest.main.svn_binary, None, 1, 'co', sbox.repo_url, wc_dir,
> + '--username', 'jconstant', '--non-interactive')
> +
> + # Checkout with jrandom which should fail since we do not provide
> + # a password and the above cached password belongs to jconstant
Exactly.
> + expected_err = ["authorization failed: Could not authenticate to server:"]
> + exit_code, output, errput = svntest.main.run_command(
> + svntest.main.svn_binary, expected_err, 1, 'co', sbox.repo_url, wc_dir,
> + '--username', 'jrandom', '--non-interactive')
> +
> +
> #----------------------------------------------------------------------
Thanks,
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-01 18:30:00 CEST