OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from pipeline_utils.appengine_third_party_pipeline_src_pipeline import handlers |
| 6 from testing_utils import testing |
| 7 |
| 8 from waterfall.pull_changelog_pipeline import PullChangelogPipeline |
| 9 |
| 10 |
| 11 REV1_COMMIT_LOG = """)]}' |
| 12 { |
| 13 "commit": "rev1", |
| 14 "tree": "tree_rev", |
| 15 "parents": [ |
| 16 "rev0" |
| 17 ], |
| 18 "author": { |
| 19 "name": "someone@chromium.org", |
| 20 "email": "someone@chromium.org", |
| 21 "time": "Wed Jun 11 19:35:32 2014" |
| 22 }, |
| 23 "committer": { |
| 24 "name": "someone@chromium.org", |
| 25 "email": "someone@chromium.org", |
| 26 "time": "Wed Jun 11 19:35:32 2014" |
| 27 }, |
| 28 "message": "git-svn-id: svn://svn.chromium.org/chromium/src@175976 blabla", |
| 29 "tree_diff": [ |
| 30 { |
| 31 "type": "add", |
| 32 "old_id": "id1", |
| 33 "old_mode": 33188, |
| 34 "old_path": "/dev/null", |
| 35 "new_id": "id2", |
| 36 "new_mode": 33188, |
| 37 "new_path": "added_file.js" |
| 38 } |
| 39 ] |
| 40 } |
| 41 """ |
| 42 |
| 43 REV1_COMMIT_LOG_URL = ('https://chromium.googlesource.com/chromium/src' |
| 44 '/+/rev1?format=json') |
| 45 |
| 46 |
| 47 class PullChangelogPipelineTest(testing.AppengineTestCase): |
| 48 app_module = handlers._APP |
| 49 |
| 50 def testPullChangelogs(self): |
| 51 with self.mock_urlfetch() as urlfetch: |
| 52 urlfetch.register_handler(REV1_COMMIT_LOG_URL, REV1_COMMIT_LOG) |
| 53 |
| 54 failure_info = { |
| 55 'builds': { |
| 56 '999': { |
| 57 'blame_list': ['rev1'] |
| 58 } |
| 59 } |
| 60 } |
| 61 |
| 62 expected_change_logs = { |
| 63 "rev1": { |
| 64 "author_name": "someone@chromium.org", |
| 65 "message": |
| 66 "git-svn-id: svn://svn.chromium.org/chromium/src@175976 blabla", |
| 67 "committer_email": "someone@chromium.org", |
| 68 "commit_position": 175976, |
| 69 "author_email": "someone@chromium.org", |
| 70 "touched_files": [ |
| 71 { |
| 72 "new_path": "added_file.js", |
| 73 "change_type": "add", |
| 74 "old_path": "/dev/null" |
| 75 } |
| 76 ], |
| 77 "author_time": "Wed Jun 11 19:35:32 2014", |
| 78 "committer_time": "Wed Jun 11 19:35:32 2014", |
| 79 "code_review_url": None, |
| 80 "committer_name": "someone@chromium.org", |
| 81 "revision": "rev1" |
| 82 } |
| 83 } |
| 84 |
| 85 pipeline = PullChangelogPipeline(failure_info) |
| 86 change_logs = pipeline.run(failure_info) |
| 87 self.assertEqual(expected_change_logs, change_logs) |
OLD | NEW |