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();
}
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();
}
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());
}
Aggregations