|
29 | 29 | ANALYZED_FILE_PATH = REPO_PATH + ANALYZED_FILE_NAME |
30 | 30 | DELETED_FILE_NAME = 'deletedFile.ext' |
31 | 31 | CURRENT_BRANCH = 'my_feature_branch' |
| 32 | +REVISION = 'mockRevision' |
32 | 33 |
|
33 | 34 |
|
34 | 35 | class PrecommitClientTest(TestCase): |
@@ -271,6 +272,10 @@ def mock_existing_findings(branch, existing_findings=None, path_prefix=DEFAULT_P |
271 | 272 | Findings can be provided as list of integers each of which represents a finding instance.""" |
272 | 273 | existing_findings_from_current_branch = to_json( |
273 | 274 | PrecommitClientTest._get_findings_as_dicts(existing_findings, path_prefix)) |
| 275 | + responses.add(responses.GET, |
| 276 | + PrecommitClientTest.get_project_service_mock('repository-timestamp-by-revision', REVISION), |
| 277 | + body=to_json([{'branchName': branch, 'timestamp': 'HEAD'}]), status=200, |
| 278 | + content_type='application/json') |
274 | 279 | responses.add(responses.GET, PrecommitClientTest.get_project_service_mock('findings', branch), |
275 | 280 | body=existing_findings_from_current_branch, status=200, |
276 | 281 | content_type="application/json", ) |
@@ -307,6 +312,7 @@ def _get_precommit_client(changed_files, deleted_files, path_prefix=DEFAULT_PATH |
307 | 312 | precommit_client.changed_files = changed_files |
308 | 313 | precommit_client.deleted_files = deleted_files |
309 | 314 | PrecommitClient.PRECOMMIT_WAITING_TIME_IN_SECONDS = 0 |
| 315 | + precommit_client._get_commit_hash = Mock(return_value=REVISION) |
310 | 316 |
|
311 | 317 | return precommit_client |
312 | 318 |
|
|
0 commit comments