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

Side by Side Diff: experimental/bisect_lib/fetch_intervening_revisions_test.py

Issue 1521503002: Update bisect_lib with the changes committed in the infra/build repo. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: In README: add back license header, add link to Telemetry docs in catapult Created 5 years 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
OLDNEW
(Empty)
1 #!/usr/bin/env 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_intervening_revisions # pylint: disable=relative-import
17
18 _TEST_DATA = os.path.join(os.path.dirname(__file__), 'test_data')
19
20
21 class FetchInterveningRevisionsTest(unittest.TestCase):
22
23 def testFetchInterveningRevisions(self):
24 response = open(os.path.join(_TEST_DATA, 'MOCK_RANGE_RESPONSE_1'))
25 with mock.patch('urllib2.urlopen', mock.MagicMock(return_value=response)):
26 revs = fetch_intervening_revisions.FetchInterveningRevisions(
27 '53fc07eb478520a80af6bf8b62be259bb55db0f1',
28 'c89130e28fd01062104e1be7f3a6fc3abbb80ca9',
29 depot_name='chromium')
30 self.assertEqual(
31 revs, [
32 ('32ce3b13924d84004a3e05c35942626cbe93cbbd', '356382'),
33 ('07a6d9854efab6677b880defa924758334cfd47d', '356383'),
34 ('22e49fb496d6ffa122c470f6071d47ccb4ccb672', '356384'),
35 ('5dbc149bebecea186b693b3d780b6965eeffed0f', '356385'),
36 ('ebd5f102ee89a4be5c98815c02c444fbf2b6b040', '356386'),
37 ('84f6037e951c21a3b00bd3ddd034f258da6839b5', '356387'),
38 ('48c1471f1f503246dd66753a4c7588d77282d2df', '356388'),
39 ('66aeb2b7084850d09f3fccc7d7467b57e4da1882', '356389'),
40 ('01542ac6d0fbec6aa78e33e6c7ec49a582072ea9', '356390'),
41 ('8414732168a8867a5d6bd45eaade68a5820a9e34', '356391'),
42 ('4f81be50501fbc02d7e44df0d56032e5885e19b6', '356392'),
43 ('7bd1741893bd4e233b5562a6926d7e395d558343', '356393'),
44 ('ee261f306c3c66e96339aa1026d62a6d953302fe', '356394'),
45 ('f1c777e3f97a16cc6a3aa922a23602fa59412989', '356395'),
46 ('8fcc8af20a3d41b0512e3b1486e4dc7de528a72b', '356396'),
47 ('3861789af25e2d3502f0fb7080da5785d31308aa', '356397'),
48 ('6feaa73a54d0515ad2940709161ca0a5ad91d1f8', '356398'),
49 ('2e93263dc74f0496100435e1fd7232e9e8323af0', '356399')
50 ])
51
52 def testFetchInterveningRevisionsPagination(self):
53
54 def MockUrlopen(url):
55 if 's=' not in url:
56 return open(os.path.join(_TEST_DATA, 'MOCK_RANGE_RESPONSE_2_PAGE_1'))
57 return open(os.path.join(_TEST_DATA, 'MOCK_RANGE_RESPONSE_2_PAGE_2'))
58
59 with mock.patch('urllib2.urlopen', MockUrlopen):
60 revs = fetch_intervening_revisions.FetchInterveningRevisions(
61 '7bd1741893bd4e233b5562a6926d7e395d558343',
62 '3861789af25e2d3502f0fb7080da5785d31308aa',
63 depot_name='chromium')
64 self.assertEqual(
65 revs, [
66 ('ee261f306c3c66e96339aa1026d62a6d953302fe', '356394'),
67 ('f1c777e3f97a16cc6a3aa922a23602fa59412989', '356395'),
68 ('8fcc8af20a3d41b0512e3b1486e4dc7de528a72b', '356396'),
69 ])
70
71
72 if __name__ == '__main__':
73 unittest.main()
OLDNEW
« no previous file with comments | « experimental/bisect_lib/fetch_intervening_revisions.py ('k') | experimental/bisect_lib/fetch_revision_info.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698