Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/git_footers_test.py

Issue 1758943002: Add Gerrit's Change-Id handling to git_footers. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « git_footers.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 """Tests for git_footers.""" 3 """Tests for git_footers."""
4 4
5 import os 5 import os
6 import sys 6 import sys
7 import unittest 7 import unittest
8 8
9 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 9 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 def testBranchHeuristic(self): 59 def testBranchHeuristic(self):
60 footers = git_footers.parse_footers(self._message + 60 footers = git_footers.parse_footers(self._message +
61 self._git_svn_id_footer_branch) 61 self._git_svn_id_footer_branch)
62 self.assertEqual( 62 self.assertEqual(
63 footers, 63 footers,
64 { 'Git-Svn-Id': [ self._git_svn_id_branch ] }) 64 { 'Git-Svn-Id': [ self._git_svn_id_branch ] })
65 self.assertEqual( 65 self.assertEqual(
66 git_footers.get_position(footers), 66 git_footers.get_position(footers),
67 ('refs/branch-heads/blabble', None)) 67 ('refs/branch-heads/blabble', None))
68 68
69 def testGetFooterChangeId(self):
70 msg = '\n'.join(['whatever',
71 '',
72 'Change-Id: ignored',
73 '', # Above is ignored because of this empty line.
74 'Change-Id: Ideadbeaf'])
75 self.assertEqual(['Ideadbeaf'], git_footers.get_footer_change_id(msg))
76
77 def testAddFooterChangeId(self):
78 self.assertEqual(
79 git_footers.add_footer_change_id('header-only', 'Ixxx'),
80 'header-only\n\nChange-Id: Ixxx')
81
82 self.assertEqual(
83 git_footers.add_footer_change_id('header\n\nsome: footter', 'Ixxx'),
84 'header\n\nChange-Id: Ixxx\nsome: footter')
85
86 self.assertEqual(
87 git_footers.add_footer_change_id('header\n\nBUG: yy', 'Ixxx'),
88 'header\n\nBUG: yy\nChange-Id: Ixxx')
89
90 self.assertEqual(
91 git_footers.add_footer_change_id('header\n\nBUG: yy\nPos: 1', 'Ixxx'),
92 'header\n\nBUG: yy\nChange-Id: Ixxx\nPos: 1')
93
94 self.assertEqual(
95 git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'),
96 'header\n\nBUG: yy\n\nChange-Id: Ixxx\nPos: 1')
97
98
69 if __name__ == '__main__': 99 if __name__ == '__main__':
70 unittest.main() 100 unittest.main()
OLDNEW
« no previous file with comments | « git_footers.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698