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

Side by Side Diff: appengine/findit/libs/gitiles/test/change_log_test.py

Issue 2657913002: [Predator] Add ``Project`` class and ``ClassifySuspect`` method to project and component classifier (Closed)
Patch Set: Fix nits. Created 3 years, 10 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 | « appengine/findit/libs/gitiles/change_log.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 # 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 import unittest 5 import unittest
6 6
7 from libs.gitiles.change_log import FileChangeInfo, ChangeLog 7 from libs.gitiles.change_log import FileChangeInfo, ChangeLog
8 8
9 9
10 class ChangeLogTest(unittest.TestCase): 10 class ChangeLogTest(unittest.TestCase):
11 def testFileChangeinfo(self): 11 def testFileChangeinfo(self):
12 filechange_dict = { 12 filechange_dict = {
13 'change_type': 'copy', 13 'change_type': 'copy',
14 'old_path': 'a', 14 'old_path': 'a',
15 'new_path': 'b' 15 'new_path': 'b'
16 } 16 }
17 filechange_info = FileChangeInfo.FromDict(filechange_dict) 17 filechange_info = FileChangeInfo.FromDict(filechange_dict)
18 self.assertEqual(filechange_dict, filechange_info.ToDict()) 18 self.assertEqual(filechange_dict, filechange_info.ToDict())
19 19
20 def testFileChangeinfoChangedPathProperty(self):
21 """Test ``changed_file`` property of ``FileChangeInfo``."""
22 modified_file = FileChangeInfo.Modify('a.cc')
23 self.assertEqual(modified_file.changed_path, 'a.cc')
24
25 added_file = FileChangeInfo.Modify('a.cc')
26 self.assertEqual(added_file.changed_path, 'a.cc')
27
28 copied_file = FileChangeInfo.Copy('old.cc', 'new.cc')
29 self.assertEqual(copied_file.changed_path, 'new.cc')
30
31 deleted_file = FileChangeInfo.Delete('old.cc')
32 self.assertEqual(deleted_file.changed_path, 'old.cc')
33
20 def testChangeLog(self): 34 def testChangeLog(self):
21 change_log_dict = { 35 change_log_dict = {
22 'author': { 36 'author': {
23 'name': 'a', 37 'name': 'a',
24 'email': 'b@email.com', 38 'email': 'b@email.com',
25 'time': '2014-08-13 00:53:12', 39 'time': '2014-08-13 00:53:12',
26 }, 40 },
27 'committer': { 41 'committer': {
28 'name': 'c', 42 'name': 'c',
29 'email': 'd@email.com', 43 'email': 'd@email.com',
(...skipping 14 matching lines...) Expand all
44 } 58 }
45 ], 59 ],
46 'message': 'blabla...', 60 'message': 'blabla...',
47 'commit_url': 'https://chromium.googlesource.com/chromium/src/+/git_hash', 61 'commit_url': 'https://chromium.googlesource.com/chromium/src/+/git_hash',
48 'code_review_url': 'https://codereview.chromium.org/2222', 62 'code_review_url': 'https://codereview.chromium.org/2222',
49 'reverted_revision': '8d4a4fa6s18raf3re12tg6r' 63 'reverted_revision': '8d4a4fa6s18raf3re12tg6r'
50 } 64 }
51 65
52 change_log = ChangeLog.FromDict(change_log_dict) 66 change_log = ChangeLog.FromDict(change_log_dict)
53 self.assertEqual(change_log_dict, change_log.ToDict()) 67 self.assertEqual(change_log_dict, change_log.ToDict())
OLDNEW
« no previous file with comments | « appengine/findit/libs/gitiles/change_log.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698