Search in sources :

Example 6 with OrgUnitActions

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

the class OrgUnitsParentAssignmentTests method setUp.

@BeforeEach
public void setUp() {
    loginActions = new LoginActions();
    orgUnitActions = new OrgUnitActions();
    loginActions.loginAsSuperUser();
}
Also used : OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with OrgUnitActions

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

the class OrgUnitsTest method setUp.

@BeforeEach
public void setUp() {
    loginActions = new LoginActions();
    userActions = new UserActions();
    orgUnitActions = new OrgUnitActions();
    loginActions.loginAsSuperUser();
}
Also used : OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with OrgUnitActions

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

the class OrgUnitProfileTests method shouldApplyProfileAttributes.

@Test
public void shouldApplyProfileAttributes() {
    // arrange
    String attributeId = attributeActions.createAttribute("TEXT", false, "organisationUnit");
    String attributeValue = DataGenerator.randomString();
    new OrgUnitActions().addAttributeValue(orgUnitId, attributeId, attributeValue);
    JsonArray array = new JsonArray();
    array.add(attributeId);
    JsonObject profileBody = orgUnitProfileActions.get().getBody();
    // act
    orgUnitProfileActions.post(new JsonObjectBuilder(profileBody).addArray("attributes", array).build()).validate().statusCode(200);
    // assert
    orgUnitProfileActions.get().validate().body("attributes", hasSize(greaterThanOrEqualTo(1)));
    orgUnitProfileActions.get("/" + orgUnitId + "/data").validate().statusCode(200).body("attributes", hasSize(1)).rootPath("attributes[0]").body("value", equalTo(attributeValue)).body("id", equalTo(attributeId)).body("label", notNullValue());
}
Also used : JsonArray(com.google.gson.JsonArray) OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) JsonObject(com.google.gson.JsonObject) JsonObjectBuilder(org.hisp.dhis.helpers.JsonObjectBuilder) Test(org.junit.jupiter.api.Test) ApiTest(org.hisp.dhis.ApiTest)

Aggregations

OrgUnitActions (org.hisp.dhis.actions.metadata.OrgUnitActions)8 LoginActions (org.hisp.dhis.actions.LoginActions)5 AttributeActions (org.hisp.dhis.actions.metadata.AttributeActions)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 RestApiActions (org.hisp.dhis.actions.RestApiActions)2 UserActions (org.hisp.dhis.actions.UserActions)2 ProgramActions (org.hisp.dhis.actions.metadata.ProgramActions)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 File (java.io.File)1 ApiTest (org.hisp.dhis.ApiTest)1 MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)1 EventActions (org.hisp.dhis.actions.tracker.EventActions)1 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)1 QueryParamsBuilder (org.hisp.dhis.helpers.QueryParamsBuilder)1 TeiDataBuilder (org.hisp.dhis.tracker.importer.databuilder.TeiDataBuilder)1 Test (org.junit.jupiter.api.Test)1