use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class BulkChangeActionTest method remove_assignee.
@Test
public void remove_assignee() throws Exception {
setUserProjectPermissions(USER);
IssueDto issueDto = db.issues().insertIssue(newUnresolvedIssue().setAssignee("arthur"));
BulkChangeWsResponse response = call(BulkChangeRequest.builder().setIssues(singletonList(issueDto.getKey())).setAssign("").build());
checkResponse(response, 1, 1, 0, 0);
IssueDto reloaded = getIssueByKeys(issueDto.getKey()).get(0);
assertThat(reloaded.getAssignee()).isNull();
assertThat(reloaded.getUpdatedAt()).isEqualTo(NOW);
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class BulkChangeActionTest method add_tags.
@Test
public void add_tags() throws Exception {
setUserProjectPermissions(USER, ISSUE_ADMIN);
IssueDto issueDto = db.issues().insertIssue(newUnresolvedIssue().setTags(asList("tag1", "tag2")));
BulkChangeWsResponse response = call(BulkChangeRequest.builder().setIssues(singletonList(issueDto.getKey())).setAddTags(singletonList("tag3")).build());
checkResponse(response, 1, 1, 0, 0);
IssueDto reloaded = getIssueByKeys(issueDto.getKey()).get(0);
assertThat(reloaded.getTags()).containsOnly("tag1", "tag2", "tag3");
assertThat(reloaded.getUpdatedAt()).isEqualTo(NOW);
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class DeleteCommentActionTest method delete_comment_using_deprecated_key_parameter.
@Test
public void delete_comment_using_deprecated_key_parameter() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
tester.newRequest().setParam("key", commentDto.getKey()).setParam("text", "please have a look").execute();
verify(responseWriter).write(eq(issueDto.getKey()), any(Request.class), any(Response.class));
assertThat(dbClient.issueChangeDao().selectCommentByKey(dbTester.getSession(), commentDto.getKey())).isNotPresent();
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class DeleteCommentActionTest method fail_when_not_enough_permission.
@Test
public void fail_when_not_enough_permission() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, "john", "please fix it");
userSession.logIn("john").addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
expectedException.expect(ForbiddenException.class);
call(commentDto.getKey());
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class DeleteCommentActionTest method fail_when_comment_has_not_user.
@Test
public void fail_when_comment_has_not_user() throws Exception {
IssueDto issueDto = issueDbTester.insertIssue();
IssueChangeDto commentDto = issueDbTester.insertComment(issueDto, null, "please fix it");
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("You can only delete your own comments");
call(commentDto.getKey());
}
Aggregations