Search in sources :

Example 11 with Student

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

the class CourseTest method courseHasFinalGrade.

@Test
public void courseHasFinalGrade() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setComputedFinalGrade("A");
    enrollment.setComputedFinalScore(95.0);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertFalse(course.getCourseGrade(false).getNoFinalGrade());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 12 with Student

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

the class CourseTest method isTA_noTaEnrollment.

@Test
public void isTA_noTaEnrollment() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertEquals(false, course.isTA());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 13 with Student

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

the class CourseTest method isCourseGradeLocked_hideFinal.

@Test
public void isCourseGradeLocked_hideFinal() {
    Course course = new Course();
    course.setHideFinalGrades(true);
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).isLocked());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 14 with Student

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

the class CourseTest method courseGrade_currentGradeNonMGP.

@Test
public void courseGrade_currentGradeNonMGP() {
    Course course = new Course();
    String currentGrade = "A";
    String finalGrade = "C";
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setCurrentGradingPeriodId(27);
    enrollment.setComputedCurrentGrade(currentGrade);
    enrollment.setComputedFinalGrade(finalGrade);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getCurrentGrade().equals(currentGrade));
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 15 with Student

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

the class CourseTest method courseGrade_finalGradeMGP.

@Test
public void courseGrade_finalGradeMGP() {
    Course course = new Course();
    course.setHasGradingPeriods(true);
    String currentGrade = "A";
    String finalGrade = "C";
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setCurrentGradingPeriodId(27);
    enrollment.setMultipleGradingPeriodsEnabled(true);
    enrollment.setCurrentPeriodComputedFinalGrade(finalGrade);
    enrollment.setCurrentPeriodComputedCurrentGrade(currentGrade);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getFinalGrade().equals(finalGrade));
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Aggregations

Enrollment (com.instructure.canvasapi2.models.Enrollment)24 Course (com.instructure.canvasapi2.models.Course)23 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)21 Student (com.instructure.canvasapi2.models.Student)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 ApiPrefs (com.instructure.canvasapi2.utils.ApiPrefs)4 ApiType (com.instructure.canvasapi2.utils.ApiType)4 Prefs (com.instructure.pandautils.utils.Prefs)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)3 Student (models.Student)3 Before (org.junit.Before)3 NonNull (android.support.annotation.NonNull)2 StatusCallback (com.instructure.canvasapi2.StatusCallback)2 BlockedStudentResponse (com.instructure.canvasapi2.models.BlockedStudentResponse)2 MismatchedRegionResponse (com.instructure.canvasapi2.models.MismatchedRegionResponse)2 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)2 RevokedTokenResponse (com.instructure.canvasapi2.models.RevokedTokenResponse)2 Response (okhttp3.Response)2