use of org.sonar.server.permission.PermissionTemplateService in project sonarqube by SonarSource.
the class ReportSubmitterTest method submit_a_report_on_existing_project.
@Test
public void submit_a_report_on_existing_project() {
ComponentDto project = db.components().insertPrivateProject();
UserDto user = db.users().insertUser();
userSession.logIn(user).addProjectPermission(SCAN_EXECUTION, project);
mockSuccessfulPrepareSubmitCall();
underTest.submit(project.getDbKey(), project.name(), emptyMap(), IOUtils.toInputStream("{binary}", StandardCharsets.UTF_8));
verifyReportIsPersisted(TASK_UUID);
verifyNoInteractions(permissionTemplateService);
verify(queue).submit(argThat(submit -> submit.getType().equals(CeTaskTypes.REPORT) && submit.getComponent().filter(cpt -> cpt.getUuid().equals(project.uuid()) && cpt.getMainComponentUuid().equals(project.uuid())).isPresent() && submit.getSubmitterUuid().equals(user.getUuid()) && submit.getUuid().equals(TASK_UUID)));
}
Aggregations