Search in sources :

Example 1 with Assignment.submissionTypeToAPIString

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

the class AssignmentUtils2Test method getAssignmentState_stateInClass.

@Test
public void getAssignmentState_stateInClass() throws Exception {
    Assignment assignment = new Assignment();
    Submission submission = null;
    long time = Calendar.getInstance().getTimeInMillis() + 100000;
    Date date = new Date(time);
    ArrayList<String> submissionTypes = new ArrayList<>();
    submissionTypes.add(Assignment.submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ON_PAPER));
    assignment.setSubmission(submission);
    assignment.setDueAt(APIHelper.dateToString(date));
    assignment.setSubmissionTypes(submissionTypes);
    int testValue = AssignmentUtils2.getAssignmentState(assignment, submission);
    assertEquals("", testValue, AssignmentUtils2.ASSIGNMENT_STATE_IN_CLASS);
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) Submission(com.instructure.canvasapi2.models.Submission) ArrayList(java.util.ArrayList) Date(java.util.Date) Test(org.junit.Test)

Example 2 with Assignment.submissionTypeToAPIString

use of com.instructure.canvasapi2.models.Assignment.submissionTypeToAPIString 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());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with Assignment.submissionTypeToAPIString

use of com.instructure.canvasapi2.models.Assignment.submissionTypeToAPIString 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());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Assignment (com.instructure.canvasapi2.models.Assignment)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 Submission (com.instructure.canvasapi2.models.Submission)1 Date (java.util.Date)1