use of org.hisp.dhis.dto.OrgUnit in project dhis2-core by dhis2.
the class OrgUnitsTest method shouldAddWithoutLevel.
@Test
public void shouldAddWithoutLevel() {
OrgUnit orgUnit = orgUnitActions.generateDummy();
orgUnit.setLevel(null);
ApiResponse response = orgUnitActions.post(orgUnit);
ResponseValidationHelper.validateObjectCreation(response);
String uid = response.extractUid();
assertNotNull(uid, "Org unit id was not returned.");
response = orgUnitActions.get(uid);
// todo create validation helper to check the similarity.
response.validate().statusCode(200).body("shortName", equalTo(orgUnit.getShortName())).body("name", equalTo(orgUnit.getName())).body("openingDate", equalTo(orgUnit.getOpeningDate()));
}
use of org.hisp.dhis.dto.OrgUnit in project dhis2-core by dhis2.
the class OrgUnitActions method generateDummy.
public OrgUnit generateDummy() {
String randomString = DataGenerator.randomString();
OrgUnit orgUnit = new OrgUnit();
orgUnit.setName("AutoTest OrgUnit" + randomString);
orgUnit.setShortName("AutoTest orgUnit short name " + randomString);
orgUnit.setOpeningDate("2017-09-11T00:00:00.000");
return orgUnit;
}
use of org.hisp.dhis.dto.OrgUnit in project dhis2-core by dhis2.
the class OrgUnitActions method createOrgUnitWithParent.
public String createOrgUnitWithParent(String parentId) {
OrgUnit orgUnit = generateDummy();
orgUnit.setParent(parentId);
return create(orgUnit);
}
use of org.hisp.dhis.dto.OrgUnit in project dhis2-core by dhis2.
the class OrgUnitActions method createOrgUnit.
public String createOrgUnit(int level) {
OrgUnit orgUnit = generateDummy();
orgUnit.setLevel(level);
return create(orgUnit);
}
use of org.hisp.dhis.dto.OrgUnit in project dhis2-core by dhis2.
the class EventImportIdSchemeTests method setupData.
private void setupData() {
ATTRIBUTE_ID = attributeActions.createUniqueAttribute("TEXT", "organisationUnit", "program");
// programAttributeId = attributeActions.createUniqueAttribute(
// "program", "TEXT" );
assertNotNull(ATTRIBUTE_ID, "Failed to setup attribute");
OrgUnit orgUnit = orgUnitActions.generateDummy();
orgUnit.setCode(OU_CODE);
orgUnit.setName(OU_NAME);
orgUnitId = orgUnitActions.create(orgUnit);
assertNotNull(orgUnitId, "Failed to setup org unit");
programActions.addOrganisationUnits(PROGRAM_ID, orgUnitId).validate().statusCode(200);
orgUnitActions.update(orgUnitId, addAttributeValuePayload(orgUnitActions.get(orgUnitId).getBody(), ATTRIBUTE_ID, ATTRIBUTE_VALUE)).validate().statusCode(200);
programActions.update(PROGRAM_ID, addAttributeValuePayload(programActions.get(PROGRAM_ID).getBody(), ATTRIBUTE_ID, ATTRIBUTE_VALUE)).validate().statusCode(200);
}
Aggregations