mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-06 11:16:28 +02:00
Merged in feature/i18n_for_plugins_v2 (pull request #92)
Feature/i18n for plugins v2
This commit is contained in:
19
scm-it/src/test/java/sonia/scm/it/I18nServletITCase.java
Normal file
19
scm-it/src/test/java/sonia/scm/it/I18nServletITCase.java
Normal 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");
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user