use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateBitbucketCloudActionTest method update_without_secret.
@Test
public void update_without_secret() {
when(encryption.isEncrypted(any())).thenReturn(false);
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("workspace", "workspace").setParam("clientId", "id").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption), AlmSettingDto::getAppId).containsOnly(tuple(almSettingDto.getKey(), "id", almSettingDto.getDecryptedPrivateKey(encryption), "workspace"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateBitbucketCloudActionTest method update_binding_without_changing_the_key.
@Test
public void update_binding_without_changing_the_key() {
when(encryption.isEncrypted(any())).thenReturn(false);
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSetting = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSetting.getKey()).setParam("newKey", almSetting.getKey()).setParam("workspace", "workspace").setParam("clientId", "id").setParam("clientSecret", "secret").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption), AlmSettingDto::getAppId).containsOnly(tuple(almSetting.getKey(), "id", "secret", "workspace"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateBitbucketCloudActionTest method update.
@Test
public void update() {
when(encryption.isEncrypted(any())).thenReturn(false);
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("workspace", "workspace").setParam("clientId", "id").setParam("clientSecret", "secret").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption), AlmSettingDto::getAppId).containsOnly(tuple(almSettingDto.getKey(), "id", "secret", "workspace"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateGitlabActionTest method update_with_new_key.
@Test
public void update_with_new_key() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertGitlabAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("newKey", "Gitlab - Infra Team").setParam("personalAccessToken", "0123456789").setParam("url", GITLAB_URL).execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, s -> s.getDecryptedPersonalAccessToken(encryption), AlmSettingDto::getUrl).containsOnly(tuple("Gitlab - Infra Team", "0123456789", GITLAB_URL));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateGitlabActionTest method update_without_pat.
@Test
public void update_without_pat() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertGitlabAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("url", GITLAB_URL).execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, s -> s.getDecryptedPersonalAccessToken(encryption)).containsOnly(tuple(almSettingDto.getKey(), GITLAB_URL, almSettingDto.getDecryptedPersonalAccessToken(encryption)));
}
Aggregations