| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 | |
| 7 from lib.gitiles.change_log import FileChangeInfo, ChangeLog | |
| 8 | |
| 9 class ChangeLogTest(unittest.TestCase): | |
| 10 def testFileChangeinfo(self): | |
| 11 filechange_dict = { | |
| 12 'change_type': 'copy', | |
| 13 'old_path': 'a', | |
| 14 'new_path': 'b' | |
| 15 } | |
| 16 filechange_info = FileChangeInfo.FromDict(filechange_dict) | |
| 17 self.assertEqual(filechange_dict, filechange_info.ToDict()) | |
| 18 | |
| 19 def testChangeLog(self): | |
| 20 change_log_dict = { | |
| 21 'author_name': 'a', | |
| 22 'author_email': 'b@email.com', | |
| 23 'author_time': '2014-08-13 00:53:12', | |
| 24 'committer_name': 'c', | |
| 25 'committer_email': 'd@email.com', | |
| 26 'committer_time': '2014-08-14 00:53:12', | |
| 27 'revision': 'aaaa', | |
| 28 'commit_position': 1111, | |
| 29 'touched_files': [ | |
| 30 { | |
| 31 'change_type': 'copy', | |
| 32 'old_path': 'old_file', | |
| 33 'new_path': 'new_file' | |
| 34 }, | |
| 35 { | |
| 36 'change_type': 'modify', | |
| 37 'old_path': 'file', | |
| 38 'new_path': 'file' | |
| 39 } | |
| 40 ], | |
| 41 'message': 'blabla...', | |
| 42 'commit_url': 'https://chromium.googlesource.com/chromium/src/+/git_hash', | |
| 43 'code_review_url': 'https://codereview.chromium.org/2222', | |
| 44 'reverted_revision': '8d4a4fa6s18raf3re12tg6r' | |
| 45 } | |
| 46 | |
| 47 change_log = ChangeLog.FromDict(change_log_dict) | |
| 48 self.assertEqual(change_log_dict, change_log.ToDict()) | |
| OLD | NEW |