use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class MetadataImportTest method shouldNotSkipSharing.
@Test
public void shouldNotSkipSharing() {
JsonObject object = generateMetadataObjectWithInvalidSharing();
ApiResponse response = metadataActions.post(object, new QueryParamsBuilder().add("skipSharing=false"));
response.validate().statusCode(409).rootPath("response").body("status", equalTo("ERROR")).body("stats.created", equalTo(0)).body("typeReports[0].objectReports[0].errorReports[0].message", stringContainsInOrder("Invalid reference", "for association `userGroupAccesses`"));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class LoginTests method shouldBeAbleToLoginWithOAuth2.
@Test
public void shouldBeAbleToLoginWithOAuth2() {
loginActions.addAuthenticationHeader(oauthClientId, secret);
ApiResponse response = uaaActions.post("oauth/token", new JsonObject(), new QueryParamsBuilder().addAll("username=" + userName, "password=" + password, "grant_type=password"));
response.validate().statusCode(200).body("access_token", notNullValue()).body("token_type", notNullValue()).body("refresh_token", notNullValue()).body("expires_in", notNullValue()).body("scope", notNullValue());
loginActions.loginWithToken(response.extractString("access_token"));
loginActions.getLoggedInUserInfo().validate().statusCode(200).body("username", equalTo(userName));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SystemSettingsTests method returnTranslationForGivenLocale.
@Test
public void returnTranslationForGivenLocale() {
prepareData();
ApiResponse response = systemSettingActions.get(APPLICATION_INTRO_KEY, ContentType.TEXT.toString(), ContentType.TEXT.toString(), new QueryParamsBuilder().add("locale=fr"));
response.validate().statusCode(200).body(containsString(FRENCH_INTRO));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SystemSettingsTests method addSystemSetting.
@Test
public void addSystemSetting() {
String specificFooter = "Learn more at ";
QueryParamsBuilder params = new QueryParamsBuilder();
params.add("value=" + specificFooter);
ApiResponse response = systemSettingActions.post(APPLICATION_FOOTER_KEY, ContentType.TEXT.toString(), new JsonObject(), params);
response.validate().statusCode(200).body(containsString(specificFooter));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SystemSettingsTests method getDefaultSystemSettingWithNonSpecifiedContentTypeAndAccept.
@Test
public void getDefaultSystemSettingWithNonSpecifiedContentTypeAndAccept() {
ApiResponse response = systemSettingActions.get(MAX_SYNC_ATTEMPTS_KEY, "", "", new QueryParamsBuilder());
response.validate().statusCode(200).body(containsString(String.valueOf(MAX_SYNC_ATTEMPTS_DEFAULT_VALUE)));
// -----------------------------------------
response = systemSettingActions.get(MAX_PASSWORD_LENGTH_KEY, "", "", new QueryParamsBuilder());
response.validate().statusCode(200).body(containsString(String.valueOf(MAX_PASSWORD_LENGTH_DEFAULT_VALUE)));
// -----------------------------------------
response = systemSettingActions.get(EMAIL_SENDER_KEY, "", "", new QueryParamsBuilder());
response.validate().statusCode(200).body(containsString(EMAIL_SENDER_DEFAULT_VALUE));
}
Aggregations