OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import mock | 7 import mock |
8 | 8 |
9 from dashboard.common import namespaced_stored_object | 9 from dashboard.common import namespaced_stored_object |
10 from dashboard.common import testing_common | 10 from dashboard.common import testing_common |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return [{'commit': 'babe852'}] | 102 return [{'commit': 'babe852'}] |
103 if first_git_hash == '0000000' and last_git_hash == '2222222': | 103 if first_git_hash == '0000000' and last_git_hash == '2222222': |
104 return [{'commit': '2222222'}, {'commit': '1111111'}] | 104 return [{'commit': '2222222'}, {'commit': '1111111'}] |
105 raise NotImplementedError() | 105 raise NotImplementedError() |
106 commit_range.side_effect = _CommitRange | 106 commit_range.side_effect = _CommitRange |
107 | 107 |
108 def _FileContents(repository_url, git_hash, path): | 108 def _FileContents(repository_url, git_hash, path): |
109 del repository_url | 109 del repository_url |
110 del path | 110 del path |
111 if git_hash == '0e57e2b': | 111 if git_hash == '0e57e2b': |
112 return 'deps = {"src/catapult": "%s@0000000"}' % _CATAPULT_URL | 112 # Also test the stripping of '.git' from repository URLs. |
| 113 return 'deps = {"src/catapult": "%s@0000000"}' % ( |
| 114 _CATAPULT_URL + '.git') |
113 if git_hash == 'babe852': | 115 if git_hash == 'babe852': |
114 return 'deps = {"src/catapult": "%s@2222222"}' % _CATAPULT_URL | 116 return 'deps = {"src/catapult": "%s@2222222"}' % _CATAPULT_URL |
115 raise NotImplementedError() | 117 raise NotImplementedError() |
116 file_contents.side_effect = _FileContents | 118 file_contents.side_effect = _FileContents |
117 | 119 |
118 change_a = change.Change(change.Dep('src', '0e57e2b')) | 120 change_a = change.Change(change.Dep('src', '0e57e2b')) |
119 change_b = change.Change(change.Dep('src', 'babe852')) | 121 change_b = change.Change(change.Dep('src', 'babe852')) |
120 expected = change.Change(change.Dep('src', '0e57e2b'), | 122 expected = change.Change(change.Dep('src', '0e57e2b'), |
121 (change.Dep('catapult', '1111111'),)) | 123 (change.Dep('catapult', '1111111'),)) |
122 | 124 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 def testFromDict(self): | 353 def testFromDict(self): |
352 patch = change.Patch.FromDict({ | 354 patch = change.Patch.FromDict({ |
353 'server': 'https://codereview.chromium.org', | 355 'server': 'https://codereview.chromium.org', |
354 'issue': 2851943002, | 356 'issue': 2851943002, |
355 'patchset': 40001, | 357 'patchset': 40001, |
356 }) | 358 }) |
357 | 359 |
358 expected = change.Patch('https://codereview.chromium.org', | 360 expected = change.Patch('https://codereview.chromium.org', |
359 2851943002, 40001) | 361 2851943002, 40001) |
360 self.assertEqual(patch, expected) | 362 self.assertEqual(patch, expected) |
OLD | NEW |