Search in sources :

Example 6 with UserActions

use of org.hisp.dhis.actions.UserActions 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 7 with UserActions

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

the class UsersRemovalTests method beforeEach.

@BeforeEach
public void beforeEach() {
    userActions = new UserActions();
    optionActions = new OptionActions();
    loginActions = new LoginActions();
    userName = (DataGenerator.randomString()).toLowerCase();
    loginActions.loginAsSuperUser();
    userId = userActions.addUser("johnny", "bravo", userName, password);
}
Also used : OptionActions(org.hisp.dhis.actions.metadata.OptionActions) UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with UserActions

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

the class EventIdSchemeTests method setupData.

private void setupData() {
    ATTRIBUTE_ID = attributeActions.createUniqueAttribute("TEXT", "organisationUnit", "program");
    assertNotNull(ATTRIBUTE_ID, "Failed to setup attribute");
    JsonObject orgUnit = JsonObjectBuilder.jsonObject(orgUnitActions.createOrgUnitBody()).addProperty("code", OU_CODE).addProperty("name", OU_NAME).build();
    orgUnitId = orgUnitActions.create(orgUnit);
    assertNotNull(orgUnitId, "Failed to setup org unit");
    new UserActions().grantCurrentUserAccessToOrgUnit(orgUnitId);
    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);
}
Also used : JsonObject(com.google.gson.JsonObject) UserActions(org.hisp.dhis.actions.UserActions)

Example 9 with UserActions

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

the class EventValidationTests method setupData.

private void setupData() {
    eventProgramStageId = programActions.programStageActions.get("", new QueryParamsBuilder().add("filter=program.id:eq:" + eventProgramId)).extractString("programStages.id[0]");
    assertNotNull(eventProgramStageId, "Failed to find a program stage");
    trackerProgramStageId = programActions.programStageActions.get("", new QueryParamsBuilder().addAll("filter=program.id:eq:" + trackerProgramId, "filter=repeatable:eq:true")).extractString("programStages.id[0]");
    ouIdWithoutAccess = new OrgUnitActions().createOrgUnit();
    new UserActions().grantCurrentUserAccessToOrgUnit(ouIdWithoutAccess);
    enrollment = trackerActions.postAndGetJobReport(new TeiDataBuilder().buildWithEnrollment(OU_ID, trackerProgramId)).validateSuccessfulImport().extractImportedEnrollments().get(0);
}
Also used : OrgUnitActions(org.hisp.dhis.actions.metadata.OrgUnitActions) TeiDataBuilder(org.hisp.dhis.tracker.importer.databuilder.TeiDataBuilder) QueryParamsBuilder(org.hisp.dhis.helpers.QueryParamsBuilder) UserActions(org.hisp.dhis.actions.UserActions)

Example 10 with UserActions

use of org.hisp.dhis.actions.UserActions 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)

Aggregations

UserActions (org.hisp.dhis.actions.UserActions)16 LoginActions (org.hisp.dhis.actions.LoginActions)12 BeforeAll (org.junit.jupiter.api.BeforeAll)7 BeforeEach (org.junit.jupiter.api.BeforeEach)6 RestApiActions (org.hisp.dhis.actions.RestApiActions)3 MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)3 JsonObject (com.google.gson.JsonObject)2 File (java.io.File)2 OrgUnitActions (org.hisp.dhis.actions.metadata.OrgUnitActions)2 ProgramActions (org.hisp.dhis.actions.metadata.ProgramActions)2 EventActions (org.hisp.dhis.actions.tracker.EventActions)2 QueryParamsBuilder (org.hisp.dhis.helpers.QueryParamsBuilder)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 UaaActions (org.hisp.dhis.actions.UaaActions)1 MetadataPaginationActions (org.hisp.dhis.actions.metadata.MetadataPaginationActions)1 OptionActions (org.hisp.dhis.actions.metadata.OptionActions)1 RelationshipTypeActions (org.hisp.dhis.actions.metadata.RelationshipTypeActions)1 PotentialDuplicatesActions (org.hisp.dhis.actions.tracker.PotentialDuplicatesActions)1 TEIActions (org.hisp.dhis.actions.tracker.TEIActions)1 TrackerActions (org.hisp.dhis.actions.tracker.importer.TrackerActions)1