Search in sources :

Example 1 with AvatarResolverImpl

use of org.sonar.server.issue.AvatarResolverImpl in project sonarqube by SonarSource.

the class SearchUsersActionTest method test_example.

@Test
public void test_example() {
    avatarResolver = new AvatarResolverImpl();
    ws = new WsActionTester(new SearchUsersAction(db.getDbClient(), wsSupport, LANGUAGES, avatarResolver));
    QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
    UserDto user1 = db.users().insertUser(u -> u.setLogin("admin").setName("Administrator").setEmail("admin@email.com"));
    UserDto user2 = db.users().insertUser(u -> u.setLogin("george.orwell").setName("George Orwell").setEmail("george@orwell.com"));
    db.qualityProfiles().addUserPermission(profile, user1);
    userSession.logIn().addPermission(ADMINISTER_QUALITY_PROFILES);
    String result = ws.newRequest().setParam(PARAM_QUALITY_PROFILE, profile.getName()).setParam(PARAM_LANGUAGE, XOO).setParam(SELECTED, "all").setMediaType(JSON).execute().getInput();
    assertJson(result).isSimilarTo(ws.getDef().responseExampleAsString());
}
Also used : QProfileDto(org.sonar.db.qualityprofile.QProfileDto) UserDto(org.sonar.db.user.UserDto) AvatarResolverImpl(org.sonar.server.issue.AvatarResolverImpl) WsActionTester(org.sonar.server.ws.WsActionTester) Test(org.junit.Test)

Example 2 with AvatarResolverImpl

use of org.sonar.server.issue.AvatarResolverImpl in project sonarqube by SonarSource.

the class SearchUsersActionTest method test_example.

@Test
public void test_example() {
    avatarResolver = new AvatarResolverImpl();
    ws = new WsActionTester(new SearchUsersAction(db.getDbClient(), wsSupport, avatarResolver));
    QualityGateDto gate = db.qualityGates().insertQualityGate();
    UserDto user1 = db.users().insertUser(u -> u.setLogin("admin").setName("Administrator").setEmail("admin@email.com"));
    UserDto user2 = db.users().insertUser(u -> u.setLogin("george.orwell").setName("George Orwell").setEmail("george@orwell.com"));
    db.qualityGates().addUserPermission(gate, user1);
    userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES);
    String result = ws.newRequest().setParam(PARAM_GATE_NAME, gate.getName()).setParam(SELECTED, "all").setMediaType(JSON).execute().getInput();
    assertJson(result).isSimilarTo(ws.getDef().responseExampleAsString());
}
Also used : UserDto(org.sonar.db.user.UserDto) AvatarResolverImpl(org.sonar.server.issue.AvatarResolverImpl) WsActionTester(org.sonar.server.ws.WsActionTester) QualityGateDto(org.sonar.db.qualitygate.QualityGateDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 UserDto (org.sonar.db.user.UserDto)2 AvatarResolverImpl (org.sonar.server.issue.AvatarResolverImpl)2 WsActionTester (org.sonar.server.ws.WsActionTester)2 QualityGateDto (org.sonar.db.qualitygate.QualityGateDto)1 QProfileDto (org.sonar.db.qualityprofile.QProfileDto)1