comparison tests/test_utility_commands.py @ 178:33ebdcb75bcd

test_utility_commands: fix normalized URL references under Windows
author Patrick Mezard <pmezard@gmail.com>
date Fri, 02 Jan 2009 15:54:07 -0600
parents 7a5a0b5c8e34
children 906d3f302b45
comparison
equal deleted inserted replaced
177:71d170253a6f 178:33ebdcb75bcd
10 10
11 import utility_commands 11 import utility_commands
12 import fetch_command 12 import fetch_command
13 import test_util 13 import test_util
14 14
15 expected_info_output = '''URL: file://%(repo)s/%(branch)s 15 expected_info_output = '''URL: %(repourl)s/%(branch)s
16 Repository Root: file://%(repo)s 16 Repository Root: %(repourl)s
17 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf 17 Repository UUID: df2126f7-00ab-4d49-b42c-7e981dde0bcf
18 Revision: %(rev)s 18 Revision: %(rev)s
19 Node Kind: directory 19 Node Kind: directory
20 Last Changed Author: durin 20 Last Changed Author: durin
21 Last Changed Rev: %(rev)s 21 Last Changed Rev: %(rev)s
28 hg.update(self.repo, 'the_branch') 28 hg.update(self.repo, 'the_branch')
29 u = ui.ui() 29 u = ui.ui()
30 utility_commands.run_svn_info(u, self.repo, self.wc_path) 30 utility_commands.run_svn_info(u, self.repo, self.wc_path)
31 expected = (expected_info_output % 31 expected = (expected_info_output %
32 {'date': '2008-10-08 01:39:05 +0000 (Wed, 08 Oct 2008)', 32 {'date': '2008-10-08 01:39:05 +0000 (Wed, 08 Oct 2008)',
33 'repo': urllib.quote(self.repo_path), 33 'repourl': test_util.fileurl(self.repo_path),
34 'branch': 'branches/the_branch', 34 'branch': 'branches/the_branch',
35 'rev': 5, 35 'rev': 5,
36 }) 36 })
37 self.assertEqual(u.stream.getvalue(), expected) 37 self.assertEqual(u.stream.getvalue(), expected)
38 hg.update(self.repo, 'default') 38 hg.update(self.repo, 'default')
39 u = ui.ui() 39 u = ui.ui()
40 utility_commands.run_svn_info(u, self.repo, self.wc_path) 40 utility_commands.run_svn_info(u, self.repo, self.wc_path)
41 expected = (expected_info_output % 41 expected = (expected_info_output %
42 {'date': '2008-10-08 01:39:29 +0000 (Wed, 08 Oct 2008)', 42 {'date': '2008-10-08 01:39:29 +0000 (Wed, 08 Oct 2008)',
43 'repo': urllib.quote(self.repo_path), 43 'repourl': test_util.fileurl(self.repo_path),
44 'branch': 'trunk', 44 'branch': 'trunk',
45 'rev': 6, 45 'rev': 6,
46 }) 46 })
47 self.assertEqual(u.stream.getvalue(), expected) 47 self.assertEqual(u.stream.getvalue(), expected)
48 48
111 def test_url_output(self): 111 def test_url_output(self):
112 self._load_fixture_and_fetch('two_revs.svndump') 112 self._load_fixture_and_fetch('two_revs.svndump')
113 hg.update(self.repo, 'tip') 113 hg.update(self.repo, 'tip')
114 u = ui.ui() 114 u = ui.ui()
115 utility_commands.print_wc_url(u, self.repo, self.wc_path) 115 utility_commands.print_wc_url(u, self.repo, self.wc_path)
116 expected = 'file://%s\n' % urllib.quote(self.repo_path) 116 expected = test_util.fileurl(self.repo_path) + '\n'
117 self.assertEqual(u.stream.getvalue(), expected) 117 self.assertEqual(u.stream.getvalue(), expected)
118 118
119 def test_rebase(self): 119 def test_rebase(self):
120 self._load_fixture_and_fetch('two_revs.svndump') 120 self._load_fixture_and_fetch('two_revs.svndump')
121 parents = (self.repo[0].node(), revlog.nullid, ) 121 parents = (self.repo[0].node(), revlog.nullid, )
151 hg_repo_path=self.wc_path, 151 hg_repo_path=self.wc_path,
152 stupid=False) 152 stupid=False)
153 hg.update(self.repo, 'tip') 153 hg.update(self.repo, 'tip')
154 u = ui.ui() 154 u = ui.ui()
155 utility_commands.print_wc_url(u, self.repo, self.wc_path) 155 utility_commands.print_wc_url(u, self.repo, self.wc_path)
156 expected = 'file://%s\n' % urllib.quote(self.repo_path) 156 expected = test_util.fileurl(self.repo_path) + '\n'
157 self.assertEqual(u.stream.getvalue(), expected) 157 self.assertEqual(u.stream.getvalue(), expected)
158 158
159 159
160 def suite(): 160 def suite():
161 all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests), 161 all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),