Search in sources :

Example 11 with RestApiActions

use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.

the class OrgUnitsRemovalTest method beforeAll.

@BeforeEach
public void beforeAll() {
    orgUnitActions = new OrgUnitActions();
    orgUnitGroupActions = new RestApiActions("/organisationUnitGroups");
    orgUnitSetActions = new RestApiActions("/organisationUnitGroupSets");
    metadataActions = new MetadataActions();
    new LoginActions().loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/metadata/orgunits/ou_with_group_and_set.json"));
}
Also used : OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) RestApiActions(org.hisp.dhis.actions.RestApiActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with RestApiActions

use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.

the class UserLookupTests method beforeAll.

@BeforeAll
public void beforeAll() {
    lookupActions = new RestApiActions("/userLookup");
    userActions = new UserActions();
    new LoginActions().loginAsSuperUser();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 13 with RestApiActions

use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.

the class UserTest method beforeEach.

@BeforeEach
public void beforeEach() {
    userActions = new UserActions();
    loginActions = new LoginActions();
    meActions = new RestApiActions("/me");
    username = ("user_tests_" + DataGenerator.randomString()).toLowerCase();
    loginActions.loginAsSuperUser();
    userActions.addUser(username, password);
    loginActions.loginAsUser(username, password);
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with RestApiActions

use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.

the class TEIimportTest method before.

@BeforeAll
public void before() throws Exception {
    teiActions = new TEIActions();
    eventActions = new EventActions();
    enrollmentActions = new RestApiActions("/enrollments");
    new LoginActions().loginAsSuperUser();
    object = new FileReaderUtils().read(new File("src/test/resources/tracker/teis/teisWithEventsAndEnrollments.json")).get(JsonObject.class);
    teiActions.post(object).validate().statusCode(200);
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) FileReaderUtils(org.hisp.dhis.helpers.file.FileReaderUtils) JsonObject(com.google.gson.JsonObject) LoginActions(org.hisp.dhis.actions.LoginActions) TEIActions(org.hisp.dhis.actions.tracker.TEIActions) EventActions(org.hisp.dhis.actions.tracker.EventActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 15 with RestApiActions

use of org.hisp.dhis.actions.RestApiActions in project dhis2-core by dhis2.

the class RelationshipsTest method before.

@BeforeAll
public void before() throws Exception {
    relationshipActions = new RelationshipActions();
    trackedEntityInstanceActions = new RestApiActions("/trackedEntityInstances");
    metadataActions = new MetadataActions();
    eventActions = new EventActions();
    new LoginActions().loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
    JsonObject teiObject = new FileReaderUtils().read(new File("src/test/resources/tracker/teis/teis.json")).replacePropertyValuesWithIds("trackedEntityInstance").get(JsonObject.class);
    teis = trackedEntityInstanceActions.post(teiObject).extractUids();
    JsonObject eventObject = new FileReaderUtils().read(new File("src/test/resources/tracker/events/events.json")).replacePropertyValuesWithIds("event").get(JsonObject.class);
    ApiResponse response = eventActions.post(eventObject).validateStatus(200);
    events = response.extractUids();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) FileReaderUtils(org.hisp.dhis.helpers.file.FileReaderUtils) JsonObject(com.google.gson.JsonObject) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) RelationshipActions(org.hisp.dhis.actions.tracker.RelationshipActions) EventActions(org.hisp.dhis.actions.tracker.EventActions) File(java.io.File) ApiResponse(org.hisp.dhis.dto.ApiResponse) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

RestApiActions (org.hisp.dhis.actions.RestApiActions)20 LoginActions (org.hisp.dhis.actions.LoginActions)13 BeforeAll (org.junit.jupiter.api.BeforeAll)10 JsonObject (com.google.gson.JsonObject)8 ApiResponse (org.hisp.dhis.dto.ApiResponse)7 File (java.io.File)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 UserActions (org.hisp.dhis.actions.UserActions)3 MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)3 FileReaderUtils (org.hisp.dhis.helpers.file.FileReaderUtils)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 SchemasActions (org.hisp.dhis.actions.SchemasActions)2 DataElementActions (org.hisp.dhis.actions.metadata.DataElementActions)2 OrgUnitActions (org.hisp.dhis.actions.metadata.OrgUnitActions)2 EventActions (org.hisp.dhis.actions.tracker.EventActions)2 TEIActions (org.hisp.dhis.actions.tracker.TEIActions)2 SchemaProperty (org.hisp.dhis.dto.schemas.SchemaProperty)2 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)2 QueryParamsBuilder (org.hisp.dhis.helpers.QueryParamsBuilder)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2