Search in sources :

Example 1 with UserActions

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

the class UserDisableTest method beforeEach.

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

Example 2 with UserActions

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

the class TrackedEntityInstanceAclReadTests method before.

@BeforeAll
public void before() throws Exception {
    teiActions = new TEIActions();
    metadataActions = new MetadataActions();
    userActions = new UserActions();
    // Setup as SuperUser
    new LoginActions().loginAsDefaultUser();
    // Set up metadata (Import twice to connect all references)
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/acl/metadata.json"));
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/acl/metadata.json"));
    // Import test data
    teiActions.postFile(new File("src/test/resources/tracker/acl/data.json"));
    // Set up all users for testing
    users.add(new User("User A", "O2PajOxjJSa", "UserA!123"));
    users.add(new User("User B", "aDy67f9ijOe", "UserB!123"));
    users.add(new User("User C", "CKrrGm5Be8O", "UserC!123"));
    users.add(new User("User D", "Lpa5INiC3Qf", "UserD!123"));
    users.add(new User("User ALL", "GTqb3WOZMop", "UserALL!123"));
    // Update passwords, so we can log in as them
    // Set AllAuth if user has it and ou scopes.
    // Map metadata and data sharing
    users.forEach(this::setupUser);
}
Also used : User(org.hisp.dhis.helpers.models.User) UserActions(org.hisp.dhis.actions.UserActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) TEIActions(org.hisp.dhis.actions.tracker.TEIActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with UserActions

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

the class OwnershipTests method beforeAll.

@BeforeAll
public void beforeAll() throws Exception {
    userActions = new UserActions();
    programActions = new ProgramActions();
    loginActions.loginAsSuperUser();
    username = createUserWithAccessToOu();
    protectedProgram = programActions.createProgramWithAccessLevel("PROTECTED", captureOu, searchOu);
    openProgram = programActions.createProgramWithAccessLevel("OPEN", captureOu, searchOu);
    String protectedProgramStageId = programActions.get(protectedProgram, new QueryParamsBuilder().add("fields=programStages")).validateStatus(200).extractString("programStages.id[0]");
    teiInCaptureScope = super.importTeiWithEnrollmentAndEvent(captureOu, protectedProgram, protectedProgramStageId).extractImportedTeis().get(0);
    teiInSearchScope = super.importTeiWithEnrollmentAndEvent(searchOu, protectedProgram, protectedProgramStageId).extractImportedTeis().get(0);
    enrollment = trackerActions.getTrackedEntity(teiInSearchScope + "?fields=enrollments").validateStatus(200).getBody();
    trackerActions.update(String.format("/ownership/transfer?trackedEntityInstance=%s&program=%s&ou=%s", teiInCaptureScope, protectedProgram, searchOu), new JsonObject()).validateStatus(200);
}
Also used : ProgramActions(org.hisp.dhis.actions.metadata.ProgramActions) QueryParamsBuilder(org.hisp.dhis.helpers.QueryParamsBuilder) UserActions(org.hisp.dhis.actions.UserActions) JsonObject(com.google.gson.JsonObject) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with UserActions

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

the class MetadataExportTests method beforeAll.

@BeforeAll
public void beforeAll() {
    metadataActions = new MetadataActions();
    loginActions = new LoginActions();
    userActions = new UserActions();
    userActions.addUser(userWithoutAccessUsername, userWithoutAccessPassword);
}
Also used : UserActions(org.hisp.dhis.actions.UserActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) LoginActions(org.hisp.dhis.actions.LoginActions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with UserActions

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

the class UserLookupTests method beforeAll.

@BeforeAll
public void beforeAll() {
    lookupActions = new RestApiActions("/userLookup");
    userActions = new UserActions();
    new LoginActions().loginAsSuperUser();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) UserActions(org.hisp.dhis.actions.UserActions) LoginActions(org.hisp.dhis.actions.LoginActions) 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