use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentAPI method getFirstPageAssignments.
public static void getFirstPageAssignments(long courseId, boolean forceNetwork, @NonNull RestBuilder adapter, @NonNull StatusCallback<List<Assignment>> callback) {
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withForceReadFromNetwork(forceNetwork).build();
callback.addCall(adapter.build(AssignmentInterface.class, params).getAssignments(courseId)).enqueue(callback);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method getLastActualSubmission_TestWorkFlowSubmitted.
@Test
public void getLastActualSubmission_TestWorkFlowSubmitted() {
Assignment assignment = new Assignment();
Submission submission = new Submission();
submission.setWorkflowState("submitted");
assignment.setSubmission(submission);
assertEquals(submission, assignment.getLastActualSubmission());
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method getLastActualSubmission_TestNullWorkFlow.
@Test
public void getLastActualSubmission_TestNullWorkFlow() {
Assignment assignment = new Assignment();
Submission submission = new Submission();
submission.setWorkflowState(null);
assignment.setSubmission(submission);
assertEquals(null, assignment.getLastActualSubmission());
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method isAllowedToSubmit_TestFalse.
@Test
public void isAllowedToSubmit_TestFalse() {
Assignment assignment = new Assignment();
List<String> submissionTypeList = new ArrayList<>();
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ATTENDANCE));
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_QUIZ));
assignment.setSubmissionTypes(submissionTypeList);
assignment.setLockedForUser(true);
assertEquals(false, assignment.isAllowedToSubmit());
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method isAllowedToSubmit_TestTrue.
@Test
public void isAllowedToSubmit_TestTrue() {
Assignment assignment = new Assignment();
List<String> submissionTypeList = new ArrayList<>();
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.DISCUSSION_TOPIC));
submissionTypeList.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_URL));
assignment.setSubmissionTypes(submissionTypeList);
assignment.setLockedForUser(false);
assertEquals(true, assignment.isAllowedToSubmit());
}
Aggregations