Search in sources :

Example 31 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class AssignmentTest method isLocked_TestUnlockAfterCurrentDate.

@Test
public void isLocked_TestUnlockAfterCurrentDate() {
    Assignment assignment = new Assignment();
    LockInfo lockInfo = new LockInfo();
    long time = Calendar.getInstance().getTimeInMillis() + 100000;
    Date date = new Date(time);
    lockInfo.setUnlockAt(APIHelper.dateToString(date));
    assignment.setLockInfo(lockInfo);
    assertEquals(true, assignment.isLocked());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) LockInfo(com.instructure.canvasapi2.models.LockInfo) Date(java.util.Date) Test(org.junit.Test)

Example 32 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class AssignmentTest method isLocked_TestLockedModuleName.

@Test
public void isLocked_TestLockedModuleName() {
    Assignment assignment = new Assignment();
    LockInfo lockInfo = new LockInfo();
    LockedModule lockedModule = new LockedModule();
    lockedModule.setName("Hodor");
    lockInfo.setContextModule(lockedModule);
    assignment.setLockInfo(lockInfo);
    assertEquals(true, assignment.isLocked());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) LockedModule(com.instructure.canvasapi2.models.LockedModule) LockInfo(com.instructure.canvasapi2.models.LockInfo) Test(org.junit.Test)

Example 33 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class DiscussionTopicHeaderTest method convertToDiscussionEntryTest_Description.

@Test
public void convertToDiscussionEntryTest_Description() throws Exception {
    String localized_graded = "Graded discussion";
    DiscussionTopicHeader header = new DiscussionTopicHeader();
    Assignment assignment = new Assignment();
    header.setAssignment(assignment);
    DiscussionEntry entry = header.convertToDiscussionEntry(localized_graded, "points");
    assertEquals(localized_graded, entry.getDescription());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) DiscussionTopicHeader(com.instructure.canvasapi2.models.DiscussionTopicHeader) DiscussionEntry(com.instructure.canvasapi2.models.DiscussionEntry) Test(org.junit.Test)

Example 34 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class AssignmentManager method deleteAssignment.

public static void deleteAssignment(long courseId, Assignment assignment, final StatusCallback<Assignment> callback) {
    if (isTesting() || mTesting) {
        AssignmentManager_Test.deleteAssignment(assignment, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
        AssignmentAPI.deleteAssignment(courseId, assignment.getId(), adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 35 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class AssignmentManager method editAssignmentAllowNullValues.

public static void editAssignmentAllowNullValues(long courseId, long assignmentId, AssignmentPostBody body, final StatusCallback<Assignment> callback) {
    if (isTesting() || mTesting) {
        AssignmentManager_Test.editAssignment(body, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
        AssignmentPostBodyWrapper bodyWrapper = new AssignmentPostBodyWrapper();
        bodyWrapper.setAssignment(body);
        AssignmentAPI.editAssignmentAllowNullValues(courseId, assignmentId, bodyWrapper, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) AssignmentPostBodyWrapper(com.instructure.canvasapi2.models.post_models.AssignmentPostBodyWrapper) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

Assignment (com.instructure.canvasapi2.models.Assignment)62 Test (org.junit.Test)46 Submission (com.instructure.canvasapi2.models.Submission)25 Date (java.util.Date)18 ArrayList (java.util.ArrayList)15 View (android.view.View)10 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)10 Course (com.instructure.canvasapi2.models.Course)9 RestParams (com.instructure.canvasapi2.builders.RestParams)7 Bundle (android.os.Bundle)6 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 Navigation (com.instructure.interactions.Navigation)5 DrawableRes (android.support.annotation.DrawableRes)4 AdapterView (android.widget.AdapterView)4 TextView (android.widget.TextView)4 Request (okhttp3.Request)4 Response (okhttp3.Response)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3