Search in sources :

Example 1 with SyncLastAccessedSubsectionResponse

use of org.edx.mobile.model.api.SyncLastAccessedSubsectionResponse in project edx-app-android by edx.

the class ApiTests method testSyncLastSubsection.

// TODO: Debug and fix test failure
@Ignore
@Test
public void testSyncLastSubsection() throws Exception {
    login();
    EnrolledCoursesResponse e = executeStrict(courseAPI.getEnrolledCourses()).get(0);
    Map<String, SectionEntry> map = courseAPI.getCourseHierarchy(e.getCourse().getId());
    Entry<String, SectionEntry> entry = map.entrySet().iterator().next();
    Entry<String, ArrayList<VideoResponseModel>> subsection = entry.getValue().sections.entrySet().iterator().next();
    String courseId = e.getCourse().getId();
    String lastVisitedModuleId = subsection.getValue().get(0).getSection().getId();
    assertNotNull(courseId);
    assertNotNull(lastVisitedModuleId);
    print(String.format("course= %s ; sub-section= %s", courseId, lastVisitedModuleId));
    // TODO: lastVisitedModuleId must be section.id (id is now available)
    SyncLastAccessedSubsectionResponse model = executeStrict(courseAPI.syncLastAccessedSubsection(courseId, lastVisitedModuleId));
    assertNotNull(model);
    print("sync returned: " + model.last_visited_module_id);
}
Also used : SyncLastAccessedSubsectionResponse(org.edx.mobile.model.api.SyncLastAccessedSubsectionResponse) EnrolledCoursesResponse(org.edx.mobile.model.api.EnrolledCoursesResponse) ArrayList(java.util.ArrayList) SectionEntry(org.edx.mobile.model.api.SectionEntry) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with SyncLastAccessedSubsectionResponse

use of org.edx.mobile.model.api.SyncLastAccessedSubsectionResponse in project edx-app-android by edx.

the class ApiTests method testGetLastAccessedModule.

// TODO: Debug and fix test failure
@Ignore
@Test
public void testGetLastAccessedModule() throws Exception {
    login();
    EnrolledCoursesResponse e = executeStrict(courseAPI.getEnrolledCourses()).get(0);
    String courseId = e.getCourse().getId();
    assertNotNull(courseId);
    print(String.format("course= %s", courseId));
    SyncLastAccessedSubsectionResponse model = executeStrict(courseAPI.getLastAccessedSubsection(courseId));
    assertNotNull(model);
// print(model.json);
}
Also used : SyncLastAccessedSubsectionResponse(org.edx.mobile.model.api.SyncLastAccessedSubsectionResponse) EnrolledCoursesResponse(org.edx.mobile.model.api.EnrolledCoursesResponse) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

EnrolledCoursesResponse (org.edx.mobile.model.api.EnrolledCoursesResponse)2 SyncLastAccessedSubsectionResponse (org.edx.mobile.model.api.SyncLastAccessedSubsectionResponse)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 SectionEntry (org.edx.mobile.model.api.SectionEntry)1