annotate tests/test_urls.py @ 467:3941d73c262e

svnwrappers: override svn+ssh credentials with supplied ones if any svn+ssh URLs are special because the authentication layer is not handled by svn, so they must contain the username to be resolved seamlessly. Until now, credentials supplied from the command line were ignored when rewriting those URLs. Fix that.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents 35993ba9d119
children 037bba1c6736
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
1 import test_util
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
2 import unittest
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 235
diff changeset
3 from hgsubversion.svnwrap.svn_swig_wrapper import parse_url
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
4
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
5 class TestSubversionUrls(test_util.TestBase):
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
6 def test_standard_url(self):
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
7 self.assertEqual((None, None, 'file:///var/svn/repo'),
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
8 parse_url('file:///var/svn/repo'))
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
9
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
10 def test_user_url(self):
467
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
11 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
12 ('joe', None, 'https://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
13 parse_url('https://joe@svn.testurl.com/repo'))
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
14 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
15 ('bob', None, 'https://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
16 parse_url('https://joe@svn.testurl.com/repo', 'bob'))
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
17
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
18 def test_password_url(self):
467
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
19 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
20 (None, 't3stpw', 'svn+ssh://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
21 parse_url('svn+ssh://:t3stpw@svn.testurl.com/repo'))
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
22 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
23 (None, '123abc', 'svn+ssh://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
24 parse_url('svn+ssh://:t3stpw@svn.testurl.com/repo', None, '123abc'))
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
25
392
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
26 def test_svnssh_preserve_user(self):
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
27 self.assertEqual(
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
28 ('user', 't3stpw', 'svn+ssh://user@svn.testurl.com/repo', ),
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
29 parse_url('svn+ssh://user:t3stpw@svn.testurl.com/repo'))
467
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
30 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
31 ('bob', '123abc', 'svn+ssh://bob@svn.testurl.com/repo', ),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
32 parse_url('svn+ssh://user:t3stpw@svn.testurl.com/repo', 'bob', '123abc'))
392
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
33 self.assertEqual(
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
34 ('user2', None, 'svn+ssh://user2@svn.testurl.com/repo', ),
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
35 parse_url('svn+ssh://user2@svn.testurl.com/repo'))
467
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
36 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
37 ('bob', None, 'svn+ssh://bob@svn.testurl.com/repo', ),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
38 parse_url('svn+ssh://user2@svn.testurl.com/repo', 'bob'))
392
35993ba9d119 urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents: 337
diff changeset
39
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
40 def test_user_password_url(self):
467
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
41 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
42 ('joe', 't3stpw', 'https://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
43 parse_url('https://joe:t3stpw@svn.testurl.com/repo'))
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
44 self.assertEqual(
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
45 ('bob', '123abc', 'https://svn.testurl.com/repo'),
3941d73c262e svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents: 392
diff changeset
46 parse_url('https://joe:t3stpw@svn.testurl.com/repo', 'bob', '123abc'))
235
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
47
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
48
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
49 def suite():
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
50 all = [unittest.TestLoader().loadTestsFromTestCase(TestSubversionUrls)]
2969a20e0eef Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff changeset
51 return unittest.TestSuite(all)