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());
}
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());
}
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());
}
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);
}
}
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);
}
}
Aggregations