use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importAndValidateMetadata.
public MetadataApiResponse importAndValidateMetadata(JsonObject object, String... queryParams) {
ApiResponse response = importMetadata(object, queryParams);
response.validate().body("response.stats.ignored", not(equalTo(response.extract("response.stats.total"))));
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class MetadataActions method importAndValidateMetadata.
public MetadataApiResponse importAndValidateMetadata(File file, String... queryParams) {
ApiResponse response = importMetadata(file, queryParams);
response.validate().body("response.stats.ignored", not(equalTo(response.extract("response.stats.total"))));
return new MetadataApiResponse(response);
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class ProgramStageActions method enableUserAssignment.
public ApiResponse enableUserAssignment(String programStageId, boolean enabled) {
JsonObject body = this.get(programStageId).getBody();
body.addProperty("enableUserAssignment", enabled);
ApiResponse response = this.update(programStageId, body);
response.validate().statusCode(200);
return response;
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class EventActions method softDelete.
public ApiResponse softDelete(String eventId) {
ApiResponse response = super.delete(eventId);
response.validate().statusCode(200);
return response;
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class LoginActions method loginAsUser.
/**
* Makes sure user with given name is logged in. Will throw assertion
* exception if authentication is not successful.
*
* @param username
* @param password
*/
public void loginAsUser(final String username, final String password) {
ApiResponse loggedInUser = getLoggedInUserInfo();
if (loggedInUser.getContentType().contains("json") && loggedInUser.extract("username") != null && loggedInUser.extract("username").equals(username)) {
return;
}
addAuthenticationHeader(username, password);
getLoggedInUserInfo().validate().statusCode(200).body("username", equalTo(username));
}
Aggregations