| 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 copy | 5 import copy |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from google.appengine.api import users | 8 from google.appengine.api import users |
| 9 | 9 |
| 10 from common.findit_testcase import FinditTestCase | |
| 11 from libs.http import retry_http_client | 10 from libs.http import retry_http_client |
| 11 from libs.testcase import TestCase |
| 12 from lib.gitiles.change_log import ChangeLog | 12 from lib.gitiles.change_log import ChangeLog |
| 13 from model.crash.crash_config import CrashConfig | 13 from model.crash.crash_config import CrashConfig |
| 14 | 14 |
| 15 | 15 |
| 16 DEFAULT_CONFIG_DATA = { | 16 DEFAULT_CONFIG_DATA = { |
| 17 'fracas': { | 17 'fracas': { |
| 18 'analysis_result_pubsub_topic': 'projects/project-name/topics/name', | 18 'analysis_result_pubsub_topic': 'projects/project-name/topics/name', |
| 19 'supported_platform_list_by_channel': { | 19 'supported_platform_list_by_channel': { |
| 20 'canary': ['win', 'mac', 'linux'], | 20 'canary': ['win', 'mac', 'linux'], |
| 21 'supported_channel': ['supported_platform'], | 21 'supported_channel': ['supported_platform'], |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 'committer_time': 'Thu Mar 31 21:28:39 2016', | 75 'committer_time': 'Thu Mar 31 21:28:39 2016', |
| 76 'commit_url': | 76 'commit_url': |
| 77 'https://repo.test/+/1', | 77 'https://repo.test/+/1', |
| 78 'code_review_url': 'https://codereview.chromium.org/3281', | 78 'code_review_url': 'https://codereview.chromium.org/3281', |
| 79 'committer_name': 'example@chromium.org', | 79 'committer_name': 'example@chromium.org', |
| 80 'revision': '1', | 80 'revision': '1', |
| 81 'reverted_revision': None | 81 'reverted_revision': None |
| 82 }) | 82 }) |
| 83 | 83 |
| 84 | 84 |
| 85 class MockHttpClient(retry_http_client.RetryHttpClient): # pragma: no cover. | |
| 86 | 85 |
| 87 def __init__(self): | 86 class CrashTestCase(TestCase): # pragma: no cover. |
| 88 super(MockHttpClient, self).__init__() | |
| 89 | |
| 90 def _Get(self, url, *_): | |
| 91 pass | |
| 92 | |
| 93 def _Post(self, *_): | |
| 94 pass | |
| 95 | |
| 96 def _Put(self, *_): | |
| 97 pass | |
| 98 | |
| 99 | |
| 100 class CrashTestCase(FinditTestCase): # pragma: no cover. | |
| 101 | 87 |
| 102 def setUp(self): | 88 def setUp(self): |
| 103 super(CrashTestCase, self).setUp() | 89 super(CrashTestCase, self).setUp() |
| 104 CrashConfig.Get().Update( | 90 CrashConfig.Get().Update( |
| 105 users.User(email='admin@chromium.org'), True, **DEFAULT_CONFIG_DATA) | 91 users.User(email='admin@chromium.org'), True, **DEFAULT_CONFIG_DATA) |
| 106 | 92 |
| 107 def GetDummyChangeLog(self): | 93 def GetDummyChangeLog(self): |
| 108 return DUMMY_CHANGELOG | 94 return DUMMY_CHANGELOG |
| 109 | |
| 110 def GetMockHttpClient(self): | |
| 111 return MockHttpClient() | |
| OLD | NEW |