use of org.sonar.db.alm.pat.AlmPatDto in project sonarqube by SonarSource.
the class ListBitbucketServerProjectsActionTest method fail_check_alm_setting_not_found.
@Test
public void fail_check_alm_setting_not_found() {
UserDto user = db.users().insertUser();
userSession.logIn(user).addPermission(PROVISION_PROJECTS);
AlmPatDto almPatDto = newAlmPatDto();
db.getDbClient().almPatDao().insert(db.getSession(), almPatDto, user.getLogin(), null);
TestRequest request = ws.newRequest().setParam("almSetting", "testKey");
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessage("ALM Setting 'testKey' not found");
}
use of org.sonar.db.alm.pat.AlmPatDto in project sonarqube by SonarSource.
the class SetPatActionTest method set_new_bitbucketserver_pat.
@Test
public void set_new_bitbucketserver_pat() {
UserDto user = db.users().insertUser();
AlmSettingDto almSetting = db.almSettings().insertBitbucketAlmSetting();
userSession.logIn(user).addPermission(PROVISION_PROJECTS);
ws.newRequest().setParam("almSetting", almSetting.getKey()).setParam("pat", "12345678987654321").execute();
Optional<AlmPatDto> actualAlmPat = db.getDbClient().almPatDao().selectByUserAndAlmSetting(db.getSession(), user.getUuid(), almSetting);
assertThat(actualAlmPat).isPresent();
assertThat(actualAlmPat.get().getPersonalAccessToken()).isEqualTo("12345678987654321");
assertThat(actualAlmPat.get().getUserUuid()).isEqualTo(user.getUuid());
assertThat(actualAlmPat.get().getAlmSettingUuid()).isEqualTo(almSetting.getUuid());
}
use of org.sonar.db.alm.pat.AlmPatDto in project sonarqube by SonarSource.
the class ListAzureProjectsActionTest method fail_check_alm_setting_not_found.
@Test
public void fail_check_alm_setting_not_found() {
UserDto user = insertUser();
AlmPatDto almPatDto = newAlmPatDto();
db.getDbClient().almPatDao().insert(db.getSession(), almPatDto, user.getLogin(), null);
TestRequest request = ws.newRequest().setParam("almSetting", "testKey");
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessage("ALM Setting 'testKey' not found");
}
use of org.sonar.db.alm.pat.AlmPatDto in project sonarqube by SonarSource.
the class ImportBitbucketCloudRepoActionTest method fail_check_alm_setting_not_found.
@Test
public void fail_check_alm_setting_not_found() {
UserDto user = db.users().insertUser();
userSession.logIn(user).addPermission(PROVISION_PROJECTS);
AlmPatDto almPatDto = newAlmPatDto();
db.getDbClient().almPatDao().insert(db.getSession(), almPatDto, user.getLogin(), null);
TestRequest request = ws.newRequest().setParam("almSetting", "testKey").setParam("repositorySlug", "repo");
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessageContaining("ALM Setting 'testKey' not found");
}
Aggregations