use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SystemSettingsTests method returnTranslationForUsersLocale.
@Test
public void returnTranslationForUsersLocale() {
prepareData();
ApiResponse response = systemSettingActions.get(APPLICATION_INTRO_KEY, ContentType.TEXT.toString(), ContentType.TEXT.toString(), new QueryParamsBuilder());
response.validate().log().all().statusCode(200).body(containsString(ENGLISH_INTRO));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class SystemSettingsTests method returnDefaultValueWhenUserIsNotLoggedIn.
@Test
@Disabled("This test is broken and will only return 200 OK because the servlet redirects to the login page. //TODO: Remove")
public void returnDefaultValueWhenUserIsNotLoggedIn() {
prepareData();
// I need to log out
loginActions.removeAuthenticationHeader();
ApiResponse response = systemSettingActions.get(APPLICATION_INTRO_KEY, ContentType.TEXT.toString(), ContentType.TEXT.toString(), new QueryParamsBuilder());
response.validate().statusCode(200);
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class TrackedEntityInstanceAclReadTests method testUserDataAndOrgUnitScopeReadAccess.
@ParameterizedTest
@ValueSource(strings = { "O2PajOxjJSa", "aDy67f9ijOe", "CKrrGm5Be8O", "Lpa5INiC3Qf", "GTqb3WOZMop" })
public void testUserDataAndOrgUnitScopeReadAccess(String userUid) {
User user = users.stream().filter(_user -> _user.getUid().equals(userUid)).findFirst().orElseThrow(() -> new RuntimeException("User UID not found for test"));
new LoginActions().loginAsUser(user.getUsername(), user.getPassword());
QueryParamsBuilder queryParamsBuilder = new QueryParamsBuilder();
queryParamsBuilder.addAll("filter=pyNnf3UaOOg:NE:zz", "trackedEntityType=YDzXLdCvV4h", "ouMode=ACCESSIBLE", "fields=*");
ApiResponse response = teiActions.get("/", queryParamsBuilder);
response.validate().statusCode(200);
response.validate().body("trackedEntityInstances", Matchers.not(Matchers.emptyArray()));
JsonObject json = response.getBody();
json.getAsJsonArray("trackedEntityInstances").iterator().forEachRemaining((teiJson) -> assertTrackedEntityInstance(user, teiJson.getAsJsonObject()));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class EventImportTests method post.
private ApiResponse post(String fileName, boolean async) {
QueryParamsBuilder queryParamsBuilder = new QueryParamsBuilder();
queryParamsBuilder.addAll("dryRun=false", "eventIdScheme=UID", "orgUnitIdScheme=UID", "async=" + String.valueOf(async));
ApiResponse response = eventActions.postFile(new File("src/test/resources/tracker/events/" + fileName), queryParamsBuilder);
return response;
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class UserAssignmentFilterTests method createEvents.
private ApiResponse createEvents(Object body) throws Exception {
ApiResponse eventResponse = eventActions.post(body, new QueryParamsBuilder().add("skipCache=true"));
eventResponse.validate().statusCode(200);
return eventResponse;
}
Aggregations