| 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 os | 5 import os |
| 6 | 6 |
| 7 from testing_utils import testing | 7 from testing_utils import testing |
| 8 | 8 |
| 9 from gae_libs.http.http_client_appengine import HttpClientAppengine | 9 from gae_libs.http.http_client_appengine import HttpClientAppengine |
| 10 from libs import time_util | 10 from libs import time_util |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 def MockUTCNow(self, mocked_utcnow): | 68 def MockUTCNow(self, mocked_utcnow): |
| 69 """Mocks utcnow with the given value for testing.""" | 69 """Mocks utcnow with the given value for testing.""" |
| 70 self.mock(time_util, 'GetUTCNow', lambda: mocked_utcnow) | 70 self.mock(time_util, 'GetUTCNow', lambda: mocked_utcnow) |
| 71 | 71 |
| 72 def MockUTCNowWithTimezone(self, mocked_utcnow): | 72 def MockUTCNowWithTimezone(self, mocked_utcnow): |
| 73 """Mocks utcnow with the given value for testing.""" | 73 """Mocks utcnow with the given value for testing.""" |
| 74 self.mock(time_util, 'GetUTCNowWithTimezone', lambda: mocked_utcnow) | 74 self.mock(time_util, 'GetUTCNowWithTimezone', lambda: mocked_utcnow) |
| 75 | 75 |
| 76 def GetMockHttpClient(self, response_for_url=None): | 76 def GetMockHttpClient(self, response_for_url=None): |
| 77 """Returns mocked http client class.""" | 77 """Returns mocked http client class.""" |
| 78 return MockHttpClient(response_for_url) | 78 return MockHttpClient(response_for_url or {}) |
| 79 |
| 80 def GetMockRepoFactory(self, response_for_url=None): |
| 81 """Returns mocked repository factory.""" |
| 82 return GitilesRepository.Factory( |
| 83 self.GetMockHttpClient(response_for_url or {})) |
| OLD | NEW |