Search in sources :

Example 1 with UserTesting.newUserDto

use of org.sonar.db.user.UserTesting.newUserDto in project sonarqube by SonarSource.

the class ChangelogActionTest method return_changelog_on_user_without_email.

@Test
public void return_changelog_on_user_without_email() throws Exception {
    UserDto user = db.users().insertUser(UserTesting.newUserDto("john", "John", null));
    IssueDto issueDto = db.issues().insertIssue(newIssue());
    userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
    db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER"));
    ChangelogWsResponse result = call(issueDto.getKey());
    assertThat(result.getChangelogList()).hasSize(1);
    assertThat(result.getChangelogList().get(0).getUser()).isNotNull().isEqualTo(user.getLogin());
    assertThat(result.getChangelogList().get(0).getUserName()).isNotNull().isEqualTo(user.getName());
    assertThat(result.getChangelogList().get(0).hasEmail()).isFalse();
}
Also used : ChangelogWsResponse(org.sonarqube.ws.Issues.ChangelogWsResponse) FieldDiffs(org.sonar.core.issue.FieldDiffs) UserDto(org.sonar.db.user.UserDto) UserTesting.newUserDto(org.sonar.db.user.UserTesting.newUserDto) IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FieldDiffs (org.sonar.core.issue.FieldDiffs)1 IssueDto (org.sonar.db.issue.IssueDto)1 UserDto (org.sonar.db.user.UserDto)1 UserTesting.newUserDto (org.sonar.db.user.UserTesting.newUserDto)1 ChangelogWsResponse (org.sonarqube.ws.Issues.ChangelogWsResponse)1