comparison tests/test_utility_commands.py @ 880:d4312a6f7a87

test_utility_commands: test verify command Also, make verify output more stable.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 21 Apr 2012 11:36:23 +0200
parents 50c13e01c7e3
children ce5837c64b12
comparison
equal deleted inserted replaced
879:055f9254d790 880:d4312a6f7a87
1 import test_util 1 import test_util
2 2
3 import os 3 import os
4 import unittest 4 import unittest
5 import re
5 6
6 from hgext import rebase 7 from hgext import rebase
7 from mercurial import hg 8 from mercurial import hg
8 from mercurial import revlog 9 from mercurial import revlog
9 from mercurial import context 10 from mercurial import context
242 svncommands.listauthors(self.ui(), 243 svncommands.listauthors(self.ui(),
243 args=[test_util.fileurl(repo_path)], 244 args=[test_util.fileurl(repo_path)],
244 authors=author_path) 245 authors=author_path)
245 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n') 246 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n')
246 247
248 def test_svnverify(self):
249 repo, repo_path = self.load_and_fetch('binaryfiles.svndump',
250 noupdate=False)
251 ret = svncommands.verify(self.ui(), repo, [], rev=1)
252 self.assertEqual(0, ret)
253 repo_path = self.load_svndump('binaryfiles-broken.svndump')
254 u = self.ui()
255 u.pushbuffer()
256 ret = svncommands.verify(u, repo, [test_util.fileurl(repo_path)],
257 rev=1)
258 output = u.popbuffer()
259 self.assertEqual(1, ret)
260 output = re.sub(r'file://\S+', 'file://', output)
261 self.assertEqual("""\
262 verifying d51f46a715a1 against file://
263 difference in file binary2
264 missing files: binary1, binary3
265 """, output)
247 266
248 def suite(): 267 def suite():
249 all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests), 268 all_tests = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),
250 ] 269 ]
251 return unittest.TestSuite(all_tests) 270 return unittest.TestSuite(all_tests)