Search in sources :

Example 6 with ListDefinitionsWsResponse

use of org.sonarqube.ws.AlmSettings.ListDefinitionsWsResponse in project sonarqube by SonarSource.

the class ListDefinitionsActionTest method list_azure_settings.

@Test
public void list_azure_settings() {
    UserDto user = db.users().insertUser();
    userSession.logIn(user).setSystemAdministrator();
    AlmSettingDto almSetting1 = db.almSettings().insertAzureAlmSetting();
    AlmSettingDto almSetting2 = db.almSettings().insertAzureAlmSetting(setting -> setting.setUrl(null));
    ListDefinitionsWsResponse wsResponse = ws.newRequest().executeProtobuf(ListDefinitionsWsResponse.class);
    assertThat(wsResponse.getAzureList()).extracting(AlmSettingAzure::getKey, AlmSettingAzure::getUrl).containsExactlyInAnyOrder(tuple(almSetting1.getKey(), almSetting1.getUrl()), tuple(almSetting2.getKey(), ""));
}
Also used : ListDefinitionsWsResponse(org.sonarqube.ws.AlmSettings.ListDefinitionsWsResponse) UserDto(org.sonar.db.user.UserDto) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) Test(org.junit.Test)

Example 7 with ListDefinitionsWsResponse

use of org.sonarqube.ws.AlmSettings.ListDefinitionsWsResponse in project sonarqube by SonarSource.

the class ListDefinitionsActionTest method list_gitlab_settings.

@Test
public void list_gitlab_settings() {
    UserDto user = db.users().insertUser();
    userSession.logIn(user).setSystemAdministrator();
    AlmSettingDto almSetting1 = db.almSettings().insertGitlabAlmSetting();
    AlmSettingDto almSetting2 = db.almSettings().insertGitlabAlmSetting(setting -> setting.setUrl(null));
    ListDefinitionsWsResponse wsResponse = ws.newRequest().executeProtobuf(ListDefinitionsWsResponse.class);
    assertThat(wsResponse.getGitlabList()).extracting(AlmSettingGitlab::getKey, AlmSettingGitlab::getUrl).containsExactlyInAnyOrder(tuple(almSetting1.getKey(), almSetting1.getUrl()), tuple(almSetting2.getKey(), ""));
}
Also used : ListDefinitionsWsResponse(org.sonarqube.ws.AlmSettings.ListDefinitionsWsResponse) UserDto(org.sonar.db.user.UserDto) AlmSettingDto(org.sonar.db.alm.setting.AlmSettingDto) Test(org.junit.Test)

Aggregations

ListDefinitionsWsResponse (org.sonarqube.ws.AlmSettings.ListDefinitionsWsResponse)7 Test (org.junit.Test)6 UserDto (org.sonar.db.user.UserDto)6 AlmSettingDto (org.sonar.db.alm.setting.AlmSettingDto)5 AlmSettings (org.sonarqube.ws.AlmSettings)1