• Home
  • Raw
  • Download

Lines Matching +full:mock +full:- +full:tests

7 #      http://www.apache.org/licenses/LICENSE-2.0
14 """Tests for clusterfuzz_deployment.py"""
18 from unittest import mock
29 # https://github.com/google/oss-fuzz/tree/master/projects/example project.
36 EXPECTED_LATEST_BUILD_PATH = os.path.join(WORKSPACE, 'cifuzz-prev-build')
38 # pylint: disable=unused-argument
64 """Tests OSSFuzz."""
72 @mock.patch('http_utils.download_and_unpack_zip', return_value=True)
74 """Tests that we can download a corpus for a valid project."""
76 expected_url = ('https://storage.googleapis.com/example-backup.'
77 'clusterfuzz-external.appspot.com/corpus/libFuzzer/'
83 @mock.patch('http_utils.download_and_unpack_zip', return_value=False)
85 """Tests that when downloading fails, an empty corpus directory is still
91 """Tests that the latest build name can be retrieved from GCS."""
98 'Not uploading latest build because on OSS-Fuzz.'),
99 ('upload_corpus', ('target', 'corpus-dir'),
100 'Not uploading corpus because on OSS-Fuzz.'),
101 ('upload_crashes', tuple(), 'Not uploading crashes because on OSS-Fuzz.'),
104 """Tests that certain methods are noops for OSS-Fuzz."""
105 with mock.patch('logging.info') as mock_info:
110 @mock.patch('http_utils.download_and_unpack_zip', return_value=True)
112 """Tests that downloading the latest build works as intended under normal
116 expected_url = ('https://storage.googleapis.com/clusterfuzz-builds/example/'
117 'example-address-202008030600.zip')
121 @mock.patch('http_utils.download_and_unpack_zip', return_value=False)
123 """Tests that download_latest_build returns None when it fails to download a
129 """Tests for ClusterFuzzLite."""
139 @mock.patch('filestore.github_actions.GithubActionsFilestore.download_corpus',
142 """Tests that download_corpus works for a valid project."""
148 @mock.patch('filestore.github_actions.GithubActionsFilestore.download_corpus',
151 """Tests that when downloading fails, an empty corpus directory is still
156 @mock.patch('filestore.github_actions.GithubActionsFilestore.download_build',
158 @mock.patch('repo_manager.RepoManager.get_commit_list',
160 @mock.patch('continuous_integration.BaseCi.repo_dir',
164 """Tests that downloading the latest build works as intended under normal
168 expected_artifact_name = 'address-commit2'
172 @mock.patch('filestore.github_actions.GithubActionsFilestore.download_build',
174 @mock.patch('repo_manager.RepoManager.get_commit_list',
176 @mock.patch('continuous_integration.BaseCi.repo_dir',
180 """Tests that download_latest_build returns None when it fails to download a
184 @mock.patch('filestore.github_actions.GithubActionsFilestore.upload_build')
186 """Tests that upload_build works as intended."""
188 mock_upload_build.assert_called_with('address-commit',
189 '/workspace/build-out')
193 """Tests for NoClusterFuzzDeployment."""
204 @mock.patch('logging.info')
206 """Tests that download corpus returns the path to the empty corpus
216 ('upload_corpus', ('target', 'corpus-dir'),
224 """Tests that certain methods are noops for NoClusterFuzzDeployment."""
225 with mock.patch('logging.info') as mock_info:
232 """Tests for get_clusterfuzz_deployment."""
249 """Tests that get_clusterfuzz_deployment returns the correct value."""
250 with mock.patch('config_utils.BaseConfig.platform',
252 new_callable=mock.PropertyMock):
253 with mock.patch('filestore_utils.get_filestore', return_value=None):