Esempio n. 1
0
    def test_grade_submission_invalid(self):
        """Tests that Teachers cannot grade Mission Submissions to classes they don't teach."""
        create_class(teacher=self.teacher, name="History of Cuba")
        schoolclass = SchoolClass.objects.get(name="History of Cuba")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        assign_mission(teacher=self.teacher,
                       schoolclass=schoolclass,
                       assignment_description="Assignment Description",
                       due_date=datetime.now() + timedelta(days=50))
        mission = Mission.objects.get(
            description_text="Assignment Description")

        submit_mission(student=self.student,
                       mission=mission,
                       content="Mission Submission Content")
        submission = MissionSubmission.objects.get(
            student=self.student,
            mission=mission,
            content="Mission Submission Content")

        grade_submission(teacher=self.teacher2,
                         submission=submission,
                         grade=100)
        self.assertEqual(submission.grade, -1)
Esempio n. 2
0
    def test_grade_submission_happy(self):
        """Tests that teachers can grade Mission Submissions"""
        create_class(teacher=self.teacher, name="History of Jamaica")
        schoolclass = SchoolClass.objects.get(name="History of Jamaica")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        assign_mission(teacher=self.teacher,
                       schoolclass=schoolclass,
                       assignment_description="Assignment Description",
                       due_date=datetime.now() + timedelta(days=50))
        mission = Mission.objects.get(
            description_text="Assignment Description")

        submit_mission(student=self.student,
                       mission=mission,
                       content="Mission Submission Content")
        submission = MissionSubmission.objects.get(
            student=self.student,
            mission=mission,
            content="Mission Submission Content")

        grade_submission(teacher=self.teacher,
                         submission=submission,
                         grade=100)
Esempio n. 3
0
    def test_mission_submission_happy(self):
        """Tests that students can upload Mission Submissions for a class they're in."""
        create_class(teacher=self.teacher, name="History of Jamaica")
        schoolclass = SchoolClass.objects.get(name="History of Jamaica")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        assign_mission(teacher=self.teacher,
                       schoolclass=schoolclass,
                       assignment_description="Assignment Description",
                       due_date=datetime.now() + timedelta(days=50))

        mission = Mission.objects.get(
            description_text="Assignment Description")
        submit_mission(student=self.student,
                       mission=mission,
                       content="Mission Submission Content")
        submission = MissionSubmission.objects.get(
            student=self.student,
            mission=mission,
            content="Mission Submission Content")

        self.assertEqual(submission.mission, mission)
        self.assertEqual(submission.student, self.student)
        self.assertEqual(submission.grade, -1)
        self.assertIn(submission.mission.schoolclass,
                      self.student.schoolclasses.all())
Esempio n. 4
0
    def test_cannot_add_another_teacher(self):
        """Tests that Teachers cannot add another Teacher to their class."""
        create_class(teacher=self.teacher, name="Aggressive Hacking")
        schoolclass = SchoolClass.objects.get(name="Aggressive Hacking")
        add_student_to_class(teacher=self.teacher,
                             student=self.teacher2,
                             schoolclass=schoolclass)

        self.assertFalse(self.teacher2.schoolclasses.all())
Esempio n. 5
0
    def test_cannot_add_to_class(self):
        """Tests that Teachers cannot add students to a class that they are not instructing."""
        SchoolClass.objects.create(name="Not My Class")
        schoolclass = SchoolClass.objects.get(name="Not My Class")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        self.assertFalse(self.teacher.schoolclasses.all())
        self.assertFalse(self.student.schoolclasses.all())
Esempio n. 6
0
    def test_add_student_to_class(self):
        """Tests happy path of a Teacher adding a Student to a class they teach."""

        create_class(teacher=self.teacher, name="History of Jamaica")
        schoolclass = SchoolClass.objects.get(name="History of Jamaica")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        for user in (self.teacher, self.student):
            self.assertTrue(user.schoolclasses.get(name="History of Jamaica"))
Esempio n. 7
0
    def test_assign_mission_fail(self):
        """Tests that teachers cannot assign missions to classes they don't teach"""
        create_class(teacher=self.teacher, name="History of Jamaica")
        schoolclass = SchoolClass.objects.get(name="History of Jamaica")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        assign_mission(teacher=self.teacher2,
                       schoolclass=schoolclass,
                       assignment_description="Assignment Description",
                       due_date=datetime.now() + timedelta(days=50))

        with self.assertRaises(Exception):
            Mission.objects.get(description_text="Assignment Description")

        self.assertFalse(Mission.objects.filter(schoolclass=schoolclass))
Esempio n. 8
0
    def test_assign_mission_happy(self):
        """Tests that teachers can assign missions to classes they instruct"""
        create_class(teacher=self.teacher, name="History of Jamaica")
        schoolclass = SchoolClass.objects.get(name="History of Jamaica")
        add_student_to_class(teacher=self.teacher,
                             student=self.student,
                             schoolclass=schoolclass)

        assign_mission(teacher=self.teacher,
                       schoolclass=schoolclass,
                       assignment_description="Assignment Description",
                       due_date=datetime.now() + timedelta(days=50))

        mission = Mission.objects.get(
            description_text="Assignment Description")

        self.assertEqual(mission.schoolclass, schoolclass)