comparison tests/test_fetch_mappings.py @ 168:4f26fa049452

authormap: Add tests, fix in stupid mode.
author Augie Fackler <durin42@gmail.com>
date Tue, 30 Dec 2008 20:14:03 -0600
parents
children a336e3e82648
comparison
equal deleted inserted replaced
167:3cd6a7354207 168:4f26fa049452
1 """Tests for author maps and file maps.
2 """
3 import os
4 import unittest
5
6 from mercurial import ui
7
8 import test_util
9 import fetch_command
10
11 class MapTests(test_util.TestBase):
12 @property
13 def authors(self):
14 return os.path.join(self.tmpdir, 'authormap')
15
16 @property
17 def filemap(self):
18 return os.path.join(self.tmpdir, 'filemap')
19
20 def test_author_map(self, stupid=False):
21 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
22 authormap = open(self.authors, 'w')
23 authormap.write("Augie=Augie Fackler <durin42@gmail.com>\n")
24 authormap.close()
25 fetch_command.fetch_revisions(ui.ui(),
26 svn_url=test_util.fileurl(self.repo_path),
27 hg_repo_path=self.wc_path,
28 stupid=stupid,
29 authors=self.authors)
30 self.assertEqual(self.repo[0].user(),
31 'Augie Fackler <durin42@gmail.com>')
32 self.assertEqual(self.repo['tip'].user(),
33 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
34
35 def test_author_map_stupid(self):
36 self.test_author_map(True)
37
38 def test_author_map_closing_author(self, stupid=False):
39 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
40 authormap = open(self.authors, 'w')
41 authormap.write("evil=Testy <test@test>")
42 authormap.close()
43 fetch_command.fetch_revisions(ui.ui(),
44 svn_url=test_util.fileurl(self.repo_path),
45 hg_repo_path=self.wc_path,
46 stupid=stupid,
47 authors=self.authors)
48 self.assertEqual(self.repo[0].user(),
49 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
50 self.assertEqual(self.repo['tip'].user(),
51 'Testy <test@test>')
52
53 def test_author_map_closing_author_stupid(self):
54 self.test_author_map_closing_author(True)
55
56
57 def suite():
58 return unittest.TestLoader().loadTestsFromTestCase(MapTests)