OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import sys |
| 8 import unittest |
| 9 |
| 10 _CATAPULT_PATH = os.path.abspath(os.path.join( |
| 11 os.path.dirname(__file__), os.path.pardir, os.path.pardir)) |
| 12 sys.path.insert(0, os.path.join(_CATAPULT_PATH, 'third_party', 'mock')) |
| 13 |
| 14 import mock |
| 15 |
| 16 import fetch_revision_info # pylint: disable=relative-import |
| 17 |
| 18 _TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), 'test_data') |
| 19 _MOCK_RESPONSE_PATH = os.path.join(_TEST_DATA_PATH, 'MOCK_INFO_RESPONSE_FILE') |
| 20 |
| 21 |
| 22 class ChromiumRevisionsTest(unittest.TestCase): |
| 23 |
| 24 def testRevisionInfo(self): |
| 25 commit_hash = 'c89130e28fd01062104e1be7f3a6fc3abbb80ca9' |
| 26 with mock.patch('urllib2.urlopen', mock.MagicMock( |
| 27 return_value=open(_MOCK_RESPONSE_PATH))): |
| 28 revision_info = fetch_revision_info.FetchRevisionInfo( |
| 29 commit_hash, depot_name='chromium') |
| 30 self.assertEqual( |
| 31 { |
| 32 'body': ('\nHiding actions without the toolbar redesign ' |
| 33 'means removing them entirely, so if\nthey exist ' |
| 34 'in the toolbar, they are considered \'visible\' ' |
| 35 '(even if they are in\nthe chevron).\n\n' |
| 36 'BUG=544859\nBUG=548160\n\nReview URL: ' |
| 37 'https://codereview.chromium.org/1414343003\n\n' |
| 38 'Cr-Commit-Position: refs/heads/master@{#356400}'), |
| 39 'date': 'Tue Oct 27 21:26:30 2015', |
| 40 'subject': ('[Extensions] Fix hiding browser actions ' |
| 41 'without the toolbar redesign'), |
| 42 'email': 'rdevlin.cronin@chromium.org', |
| 43 'author': 'rdevlin.cronin' |
| 44 }, |
| 45 revision_info) |
| 46 |
| 47 |
| 48 if __name__ == '__main__': |
| 49 unittest.main() |
OLD | NEW |