comparison tests/test_urls.py @ 468:037bba1c6736

svnrepo: expose the same svnurl than SubversionRepo Since the ssh+svn URLs depend on supplied credentials, and because we want to get the actual SVN URL without talking to the remote repository, we duplicate the work done by SubversionRepo.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents 3941d73c262e
children 5567af673f83
comparison
equal deleted inserted replaced
467:3941d73c262e 468:037bba1c6736
1 import test_util 1 import test_util
2 import unittest 2 import unittest
3 from hgsubversion.svnwrap.svn_swig_wrapper import parse_url 3 from hgsubversion.svnwrap.svn_swig_wrapper import parse_url
4 from hgsubversion import svnrepo
4 5
5 class TestSubversionUrls(test_util.TestBase): 6 class TestSubversionUrls(test_util.TestBase):
6 def test_standard_url(self): 7 def test_standard_url(self):
7 self.assertEqual((None, None, 'file:///var/svn/repo'), 8 self.assertEqual((None, None, 'file:///var/svn/repo'),
8 parse_url('file:///var/svn/repo')) 9 parse_url('file:///var/svn/repo'))
43 parse_url('https://joe:t3stpw@svn.testurl.com/repo')) 44 parse_url('https://joe:t3stpw@svn.testurl.com/repo'))
44 self.assertEqual( 45 self.assertEqual(
45 ('bob', '123abc', 'https://svn.testurl.com/repo'), 46 ('bob', '123abc', 'https://svn.testurl.com/repo'),
46 parse_url('https://joe:t3stpw@svn.testurl.com/repo', 'bob', '123abc')) 47 parse_url('https://joe:t3stpw@svn.testurl.com/repo', 'bob', '123abc'))
47 48
49 class TestSvnRepo(test_util.TestBase):
50 def test_url_rewriting(self):
51 ui = test_util.ui.ui()
52 ui.setconfig('hgsubversion', 'username', 'bob')
53 repo = svnrepo.svnremoterepo(ui, 'svn+ssh://joe@foo/bar')
54 self.assertEqual('svn+ssh://bob@foo/bar', repo.svnurl)
48 55
49 def suite(): 56 def suite():
50 all = [unittest.TestLoader().loadTestsFromTestCase(TestSubversionUrls)] 57 all = [unittest.TestLoader().loadTestsFromTestCase(TestSubversionUrls)]
51 return unittest.TestSuite(all) 58 return unittest.TestSuite(all)