Mercurial > hgsubversion
annotate tests/test_urls.py @ 654:e4f9603ab82a
verify: add end-of-line to ui.write() calls.
It's prettier this way.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 06 Aug 2010 14:43:40 +0200 |
parents | 15443c592f7a |
children | 2cc1342d4476 |
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 |
468
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
4 from hgsubversion import svnrepo |
235
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
5 |
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
6 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
|
7 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
|
8 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
|
9 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
|
10 |
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
11 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
|
12 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
13 ('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
|
14 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
|
15 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
16 ('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
|
17 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
|
18 |
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
19 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
|
20 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
21 (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
|
22 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
|
23 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
24 (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
|
25 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
|
26 |
392
35993ba9d119
urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents:
337
diff
changeset
|
27 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
|
28 self.assertEqual( |
35993ba9d119
urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents:
337
diff
changeset
|
29 ('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
|
30 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
|
31 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
32 ('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
|
33 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
|
34 self.assertEqual( |
35993ba9d119
urls: Make sure we preserve username in urls given to ssh.
Augie Fackler <durin42@gmail.com>
parents:
337
diff
changeset
|
35 ('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
|
36 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
|
37 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
38 ('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
|
39 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
|
40 |
235
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
41 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
|
42 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
43 ('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
|
44 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
|
45 self.assertEqual( |
3941d73c262e
svnwrappers: override svn+ssh credentials with supplied ones if any
Patrick Mezard <pmezard@gmail.com>
parents:
392
diff
changeset
|
46 ('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
|
47 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
|
48 |
468
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
49 class TestSvnRepo(test_util.TestBase): |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
50 def test_url_rewriting(self): |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
51 ui = test_util.ui.ui() |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
52 ui.setconfig('hgsubversion', 'username', 'bob') |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
53 repo = svnrepo.svnremoterepo(ui, 'svn+ssh://joe@foo/bar') |
037bba1c6736
svnrepo: expose the same svnurl than SubversionRepo
Patrick Mezard <pmezard@gmail.com>
parents:
467
diff
changeset
|
54 self.assertEqual('svn+ssh://bob@foo/bar', repo.svnurl) |
235
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
55 |
469
5567af673f83
Revive svn+http(s) URLs support (issue94)
Patrick Mezard <pmezard@gmail.com>
parents:
468
diff
changeset
|
56 repo = svnrepo.svnremoterepo(ui, 'svn+http://joe@foo/bar') |
5567af673f83
Revive svn+http(s) URLs support (issue94)
Patrick Mezard <pmezard@gmail.com>
parents:
468
diff
changeset
|
57 self.assertEqual(('http://foo/bar', 'bob', None), repo.svnauth) |
5567af673f83
Revive svn+http(s) URLs support (issue94)
Patrick Mezard <pmezard@gmail.com>
parents:
468
diff
changeset
|
58 |
475
15443c592f7a
Remove the svn+ from svn+https urls before calling the Subversion API. This was already being done for svn+http urls.
David Stanek <dstanek@dstanek.com>
parents:
469
diff
changeset
|
59 repo = svnrepo.svnremoterepo(ui, 'svn+https://joe@foo/bar') |
15443c592f7a
Remove the svn+ from svn+https urls before calling the Subversion API. This was already being done for svn+http urls.
David Stanek <dstanek@dstanek.com>
parents:
469
diff
changeset
|
60 self.assertEqual(('https://foo/bar', 'bob', None), repo.svnauth) |
15443c592f7a
Remove the svn+ from svn+https urls before calling the Subversion API. This was already being done for svn+http urls.
David Stanek <dstanek@dstanek.com>
parents:
469
diff
changeset
|
61 |
235
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
62 def suite(): |
2969a20e0eef
Add support for user:pass@url repositories to be hg-like
Daniel Tang <dytang@cs.purdue.edu>
parents:
diff
changeset
|
63 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
|
64 return unittest.TestSuite(all) |