Search in sources :

Example 1 with TEIActions

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

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

the class TEIimportTest method before.

@BeforeAll
public void before() throws Exception {
    teiActions = new TEIActions();
    eventActions = new EventActions();
    enrollmentActions = new RestApiActions("/enrollments");
    new LoginActions().loginAsSuperUser();
    object = new FileReaderUtils().read(new File("src/test/resources/tracker/teis/teisWithEventsAndEnrollments.json")).get(JsonObject.class);
    teiActions.post(object).validate().statusCode(200);
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) FileReaderUtils(org.hisp.dhis.helpers.file.FileReaderUtils) JsonObject(com.google.gson.JsonObject) LoginActions(org.hisp.dhis.actions.LoginActions) TEIActions(org.hisp.dhis.actions.tracker.TEIActions) EventActions(org.hisp.dhis.actions.tracker.EventActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with TEIActions

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

the class RelationshipsTests method beforeAll.

@BeforeAll
public void beforeAll() throws Exception {
    teiActions = new TEIActions();
    metadataActions = new MetadataActions();
    relationshipTypeActions = new RestApiActions("/relationshipTypes");
    loginActions.loginAsSuperUser();
    metadataActions.importAndValidateMetadata(new File("src/test/resources/tracker/relationshipTypes.json"));
    teis = importTeis();
    events = importEvents();
}
Also used : RestApiActions(org.hisp.dhis.actions.RestApiActions) MetadataActions(org.hisp.dhis.actions.metadata.MetadataActions) TEIActions(org.hisp.dhis.actions.tracker.TEIActions) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

File (java.io.File)3 TEIActions (org.hisp.dhis.actions.tracker.TEIActions)3 BeforeAll (org.junit.jupiter.api.BeforeAll)3 LoginActions (org.hisp.dhis.actions.LoginActions)2 RestApiActions (org.hisp.dhis.actions.RestApiActions)2 MetadataActions (org.hisp.dhis.actions.metadata.MetadataActions)2 JsonObject (com.google.gson.JsonObject)1 UserActions (org.hisp.dhis.actions.UserActions)1 EventActions (org.hisp.dhis.actions.tracker.EventActions)1 FileReaderUtils (org.hisp.dhis.helpers.file.FileReaderUtils)1 User (org.hisp.dhis.helpers.models.User)1