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

Side by Side Diff: appengine/findit/util_scripts/git_checkout/test/local_git_parsers_test.py

Issue 2432113002: [Findit] Add local_git_repository (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime 5 from datetime import datetime
6 from datetime import timedelta 6 from datetime import timedelta
7 import os 7 import os
8 import sys 8 import sys
9 import textwrap 9 import textwrap
10 import unittest 10 import unittest
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 'revision', 425880, message, [change_log.FileChangeInfo( 122 'revision', 425880, message, [change_log.FileChangeInfo(
123 'modify', 'src/a/b.py', 'src/a/b.py')], 123 'modify', 'src/a/b.py', 'src/a/b.py')],
124 'https://repo/+/revision', 124 'https://repo/+/revision',
125 'https://codereview.chromium.org/2391763002', 125 'https://codereview.chromium.org/2391763002',
126 'c9cc182781484f9010f062859cda048afefefefe') 126 'c9cc182781484f9010f062859cda048afefefefe')
127 127
128 changelog = local_git_parsers.GitChangeLogParser()(output, 'https://repo') 128 changelog = local_git_parsers.GitChangeLogParser()(output, 'https://repo')
129 self.assertTrue(expected_changelog.ToDict(), changelog.ToDict()) 129 self.assertTrue(expected_changelog.ToDict(), changelog.ToDict())
130 130
131 def testGitChangeLogParserParseEmptyOutput(self): 131 def testGitChangeLogParserParseEmptyOutput(self):
132 output = None 132 self.assertIsNone(local_git_parsers.GitChangeLogParser()(None, 'repo'))
133 self.assertIsNone(local_git_parsers.GitChangeLogParser()(output, 'repo'))
134 133
135 def testGitChangeLogsParser(self): 134 def testGitChangeLogsParser(self):
136 output = textwrap.dedent( 135 output = textwrap.dedent(
137 """ 136 """
138 **Changelog start** 137 **Changelog start**
139 commit rev1 138 commit rev1
140 tree 27b0421273ed4aea25e497c6d26d9c7db6481852 139 tree 27b0421273ed4aea25e497c6d26d9c7db6481852
141 parents rev22c9e 140 parents rev22c9e
142 141
143 author author1 142 author author1
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 'rev3', None, 224 'rev3', None,
226 'Message 3', [change_log.FileChangeInfo( 225 'Message 3', [change_log.FileChangeInfo(
227 'rename', 'b/c.py', 'b/cc.py')], 226 'rename', 'b/c.py', 'b/cc.py')],
228 'http://repo/+/rev3', None, None), 227 'http://repo/+/rev3', None, None),
229 ] 228 ]
230 229
231 changelogs = local_git_parsers.GitChangeLogsParser()(output, 'http://repo') 230 changelogs = local_git_parsers.GitChangeLogsParser()(output, 'http://repo')
232 for changelog, expected_changelog in zip(changelogs, expected_changelogs): 231 for changelog, expected_changelog in zip(changelogs, expected_changelogs):
233 self.assertEqual(changelog.ToDict(), expected_changelog.ToDict()) 232 self.assertEqual(changelog.ToDict(), expected_changelog.ToDict())
234 233
235
236 def testGitChangeLogsParserParseEmptyOutput(self): 234 def testGitChangeLogsParserParseEmptyOutput(self):
237 output = None 235 self.assertIsNone(local_git_parsers.GitChangeLogsParser()(None, 'repo'))
238 self.assertIsNone(local_git_parsers.GitChangeLogsParser()(output, 'repo'))
239 236
240 def testGitChangeLogsParserWithEmptyChangelog(self): 237 def testGitChangeLogsParserWithEmptyChangelog(self):
241 output = '**Changelog start**\nblablabla' 238 output = '**Changelog start**\nblablabla'
242 self.assertEqual(local_git_parsers.GitChangeLogsParser()(output, 239 self.assertEqual(local_git_parsers.GitChangeLogsParser()(output,
243 'http://repo'), []) 240 'http://repo'), [])
244 241
245 def testGitDiffParser(self): 242 def testGitDiffParser(self):
246 output = 'output' 243 output = 'output'
247 self.assertEqual(output, local_git_parsers.GitDiffParser()(output)) 244 self.assertEqual(output, local_git_parsers.GitDiffParser()(output))
248 245
249 def testGitSourceParser(self): 246 def testGitSourceParser(self):
250 output = 'output' 247 output = 'output'
251 self.assertEqual(output, local_git_parsers.GitSourceParser()(output)) 248 self.assertEqual(output, local_git_parsers.GitSourceParser()(output))
252 249
253 250
254 if __name__ == '__main__': 251 if __name__ == '__main__':
255 unittest.main() 252 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698