Merged in feature/i18n_for_plugins_v2 (pull request #92)

Feature/i18n for plugins v2
This commit is contained in:
Sebastian Sdorra
2018-10-24 09:22:47 +00:00
14 changed files with 548 additions and 16 deletions

View File

@@ -0,0 +1,19 @@
package sonia.scm.it;
import org.junit.Test;
import sonia.scm.it.utils.ScmRequests;
import static org.assertj.core.api.Assertions.assertThat;
public class I18nServletITCase {
@Test
public void shouldGetCollectedPluginTranslations() {
ScmRequests.start()
.requestPluginTranslations("de")
.assertStatusCode(200)
.assertSingleProperty(value -> assertThat(value).isNotNull(), "scm-git-plugin")
.assertSingleProperty(value -> assertThat(value).isNotNull(), "scm-hg-plugin")
.assertSingleProperty(value -> assertThat(value).isNotNull(), "scm-svn-plugin");
}
}

View File

@@ -54,7 +54,12 @@ public class ScmRequests {
setUsername(username);
setPassword(password);
return new ChangePasswordResponse<>(applyPUTRequest(RestUtil.REST_BASE_URL.resolve("users/"+userPathParam+"/password").toString(), VndMediaType.PASSWORD_OVERWRITE, TestData.createPasswordChangeJson(password,newPassword)), null);
}
@SuppressWarnings("unchecked")
public ModelResponse requestPluginTranslations(String language) {
Response response = applyGETRequest(RestUtil.BASE_URL.resolve("locales/" + language + "/plugins.json").toString());
return new ModelResponse(response, null);
}
/**
@@ -94,6 +99,11 @@ public class ScmRequests {
*/
private Response applyGETRequestWithQueryParams(String url, String params) {
LOG.info("GET {}", url);
if (username == null || password == null){
return RestAssured.given()
.when()
.get(url + params);
}
return RestAssured.given()
.auth().preemptive().basic(username, password)
.when()