OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import os | 5 import os |
6 import unittest | 6 import unittest |
7 | 7 |
8 from infra.tools.antibody import git_commit_parser | 8 from infra.tools.antibody import git_commit_parser |
9 | 9 |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 def test_parse_commit_info(self): | 23 def test_parse_commit_info(self): |
24 self.assertEqual(type(self.log), list) | 24 self.assertEqual(type(self.log), list) |
25 self.assertEqual(type(self.log[0]), dict) | 25 self.assertEqual(type(self.log[0]), dict) |
26 | 26 |
27 def test_get_features_for_git_commit(self): | 27 def test_get_features_for_git_commit(self): |
28 for commit in self.log: | 28 for commit in self.log: |
29 if commit['id'] == 'df88fd603ca6a3831b4f2b21156a3e0d93e30095': | 29 if commit['id'] == 'df88fd603ca6a3831b4f2b21156a3e0d93e30095': |
30 self.assertEqual(git_commit_parser.get_features_for_git_commit(commit), | 30 self.assertEqual(git_commit_parser.get_features_for_git_commit(commit), |
31 ('df88fd603ca6a3831b4f2b21156a3e0d93e30095', None, | 31 ('df88fd603ca6a3831b4f2b21156a3e0d93e30095', None, |
32 '2012-11-13 15:13:54', | 32 '2012-11-13 15:13:54', |
33 'https://codereview.appspot.com/6846046/', None)) | 33 'https://codereview.appspot.com/6846046/', None, |
| 34 'Add new index to make sure the CQ never ever get ' |
| 35 'blocked again')) |
34 | 36 |
35 def test_get_features_for_commit_people(self): | 37 def test_get_features_for_commit_people(self): |
36 for commit in self.log: | 38 for commit in self.log: |
37 if commit['id'] == 'df88fd603ca6a3831b4f2b21156a3e0d93e30095': | 39 if commit['id'] == 'df88fd603ca6a3831b4f2b21156a3e0d93e30095': |
38 features = git_commit_parser.get_features_for_commit_people(commit) | 40 features = git_commit_parser.get_features_for_commit_people(commit) |
39 comparable_features = [(x[0], x[1], None, x[3]) for x in features] | 41 comparable_features = [(x[0], x[1], None, x[3]) for x in features] |
40 self.assertEqual(comparable_features, | 42 self.assertEqual(comparable_features, |
41 [('maruel@chromium.org', | 43 [('maruel', |
42 'df88fd603ca6a3831b4f2b21156a3e0d93e30095', | 44 'df88fd603ca6a3831b4f2b21156a3e0d93e30095', |
43 None, 'author'), ('ilevy@chromium.org', | 45 None, 'author'), ('ilevy', |
44 'df88fd603ca6a3831b4f2b21156a3e0d93e30095', None, | 46 'df88fd603ca6a3831b4f2b21156a3e0d93e30095', None, |
45 'tbr')]) | 47 'tbr')]) |
46 | 48 |
47 def test_parse_commit_message(self): | 49 def test_parse_commit_message(self): |
48 commits = git_commit_parser.parse_commit_message(self.log) | 50 commits = git_commit_parser.parse_commit_message(self.log) |
49 self.assertTrue(len(commits) > 0) | 51 self.assertTrue(len(commits) > 0) |
50 | 52 |
51 def test_parse_commit_people(self): | 53 def test_parse_commit_people(self): |
52 commits = git_commit_parser.parse_commit_people(self.log) | 54 commits = git_commit_parser.parse_commit_people(self.log) |
53 self.assertTrue(len(commits) > 0) | 55 self.assertTrue(len(commits) > 0) |
OLD | NEW |