Search in sources :

Example 16 with UserActions

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

the class MetadataSetupExtension method setupUsers.

private void setupUsers() {
    logger.info("Adding users to the TA user group");
    UserActions userActions = new UserActions();
    String[] users = { TestConfiguration.get().superUserUsername(), TestConfiguration.get().defaultUserUsername(), TestConfiguration.get().adminUserUsername() };
    String userGroupId = Constants.USER_GROUP_ID;
    for (String user : users) {
        String userId = userActions.get(String.format("?filter=username:eq:%s", user)).extractString("users.id[0]");
        if (userId == null) {
            return;
        }
        userActions.addUserToUserGroup(userId, userGroupId);
        TestRunStorage.removeEntity("users", userId);
    }
}
Also used : UserActions(org.hisp.dhis.actions.UserActions)

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