Search in sources :

Example 11 with MetadataActions

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

the class RelationshipsTests method beforeAll.

@BeforeAll
public void beforeAll() throws Exception {
    teiActions = new TEIActions();
    metadataActions = new MetadataActions();
    relationshipTypeActions = new RestApiActions("/relationshipTypes");
    loginActions.loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
    teis = importTeis();
    events = importEvents();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) TEIActions(org.hisp.dhis.actions.tracker.TEIActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 12 with MetadataActions

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

the class UserAssignmentTests method beforeAll.

@BeforeAll
public void beforeAll() {
    programActions = new ProgramActions();
    metadataActions = new MetadataActions();
    loginActions.loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/eventProgram.json"));
}
Also used : ProgramActions(org.hisp.dhis.actions.metadata.ProgramActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 13 with MetadataActions

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

the class UserAssignmentFilterTests method beforeAll.

@BeforeAll
public void beforeAll() throws Exception {
    eventActions = new EventActions();
    loginActions = new LoginActions();
    metadataActions = new MetadataActions();
    userActions = new UserActions();
    userUsername = ("EventFiltersUser" + DataGenerator.randomString()).toLowerCase();
    loginActions.loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/eventProgram.json"));
    userId = userActions.addUser(userUsername, userPassword);
    userActions.grantUserAccessToOrgUnit(userId, orgUnit);
    userActions.addUserToUserGroup(userId, Constants.USER_GROUP_ID);
    userActions.addRoleToUser(userId, Constants.USER_ROLE_ID);
    eventsBody = getEventsBody(programId, "l8oDIfJJhtg", userId);
}
Also used : UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) EventActions(org.hisp.dhis.actions.tracker.EventActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 14 with MetadataActions

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

the class RuleEngineTests method beforeAll.

@BeforeAll
public void beforeAll() {
    messageConversationsActions = new MessageConversationsActions();
    loginActions.loginAsSuperUser();
    new MetadataActions().importAndValidateMetadata(new File("src/test/resources/tracker/programs_with_program_rules.json"));
}
Also used : MessageConversationsActions(org.hisp.dhis.actions.MessageConversationsActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 15 with MetadataActions

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

the class OrgUnitProfileTests method shouldApplyGroupSets.

@Test
public void shouldApplyGroupSets() {
    // arrange
    MetadataApiResponse response = new MetadataActions().importAndValidateMetadata(new File("src/test/resources/metadata/orgunits/ou_with_group_and_set.json"));
    String groupSet = response.extractObjectUid("OrganisationUnitGroupSet").get(0);
    String ou = response.extractObjectUid("OrganisationUnit").get(0);
    JsonArray array = new JsonArray();
    array.add(groupSet);
    JsonObject profileBody = new JsonObjectBuilder().addArray("groupSets", array).build();
    // act
    orgUnitProfileActions.post(profileBody).validate().statusCode(200);
    // assert
    orgUnitProfileActions.get().validate().body("groupSets", hasSize(greaterThanOrEqualTo(1)));
    orgUnitProfileActions.get("/" + ou + "/data").validate().statusCode(200).body("groupSets", hasSize(1)).rootPath("groupSets[0]").body("id", equalTo(groupSet)).body("label", notNullValue()).body("value", notNullValue());
}
Also used : JsonArray(com.google.gson.JsonArray) MetadataApiResponse(org.hisp.dhis.dto.MetadataApiResponse) JsonObject(com.google.gson.JsonObject) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) JsonObjectBuilder(org.hisp.dhis.helpers.JsonObjectBuilder) File(java.io.File) Test(org.junit.jupiter.api.Test) ApiTest(org.hisp.dhis.ApiTest)

Aggregations

MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)15 File (java.io.File)12 BeforeAll (org.junit.jupiter.api.BeforeAll)11 LoginActions (org.hisp.dhis.actions.LoginActions)10 JsonObject (com.google.gson.JsonObject)3 RestApiActions (org.hisp.dhis.actions.RestApiActions)3 UserActions (org.hisp.dhis.actions.UserActions)3 EventActions (org.hisp.dhis.actions.tracker.EventActions)3 SystemActions (org.hisp.dhis.actions.SystemActions)2 ProgramActions (org.hisp.dhis.actions.metadata.ProgramActions)2 TEIActions (org.hisp.dhis.actions.tracker.TEIActions)2 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)2 FileReaderUtils (org.hisp.dhis.helpers.file.FileReaderUtils)2 JsonArray (com.google.gson.JsonArray)1 ApiTest (org.hisp.dhis.ApiTest)1 IdGenerator (org.hisp.dhis.actions.IdGenerator)1 MessageConversationsActions (org.hisp.dhis.actions.MessageConversationsActions)1 DataValueActions (org.hisp.dhis.actions.aggregate.DataValueActions)1 DataValueSetActions (org.hisp.dhis.actions.aggregate.DataValueSetActions)1 OrgUnitActions (org.hisp.dhis.actions.metadata.OrgUnitActions)1