예제 #1
0
    def setUp(self):
        super().setUp()
        self.project = obj_build.build_project()
        self.course = self.project.course
        self.client = APIClient()
        self.url = reverse('handgrading_rubric',
                           kwargs={'project_pk': self.project.pk})

        self.data = {
            'points_style':
            handgrading_models.PointsStyle.start_at_zero_and_add.value,
            'max_points': 20,
            'show_grades_and_rubric_to_students': True,
            'handgraders_can_leave_comments': True,
            'handgraders_can_adjust_points': True,
        }
예제 #2
0
    def setUp(self):
        self.default_handgrading_rubric = (
            handgrading_models.HandgradingRubric.objects.validate_and_create(
                points_style=handgrading_models.PointsStyle.start_at_max_and_subtract,
                max_points=0,
                show_grades_and_rubric_to_students=False,
                handgraders_can_leave_comments=True,
                handgraders_can_adjust_points=True,
                project=obj_build.build_project())
        )

        self.default_criterion = {
            "short_description": "",
            "long_description": "",
            "points": 0,
            "handgrading_rubric": self.default_handgrading_rubric
        }
    def setUp(self):
        super().setUp()
        handgrading_rubric = (
            handgrading_models.HandgradingRubric.objects.validate_and_create(
                points_style=handgrading_models.PointsStyle.
                start_at_max_and_subtract,
                max_points=0,
                show_grades_and_rubric_to_students=False,
                handgraders_can_leave_comments=True,
                handgraders_can_adjust_points=True,
                project=obj_build.build_project()))

        location_data = {
            "first_line": 0,
            "last_line": 1,
            "filename": "test.cpp"
        }

        annotation = handgrading_models.Annotation.objects.validate_and_create(
            handgrading_rubric=handgrading_rubric)

        submission = obj_build.make_submission(
            submitted_filenames=["test.cpp"])

        self.handgrading_result = (
            handgrading_models.HandgradingResult.objects.validate_and_create(
                submission=submission,
                group=submission.group,
                handgrading_rubric=handgrading_rubric))

        applied_annotation_data = {
            "location": location_data,
            "annotation": annotation,
            "handgrading_result": self.handgrading_result
        }

        self.applied_annotation = handgrading_models.AppliedAnnotation.objects.validate_and_create(
            **applied_annotation_data)

        self.course = handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse(
            'applied_annotations',
            kwargs={'handgrading_result_pk': self.handgrading_result.pk})
    def setUp(self):
        super().setUp()

        self.to_invite = obj_build.create_dummy_users(3)
        self.to_invite_usernames = [user.username for user in self.to_invite]

        self.invitation_creator = obj_build.create_dummy_user()
        self.invitation_creator_username = self.invitation_creator.username

        self.project = obj_build.build_project(
            project_kwargs={
                'min_group_size': 1,
                'max_group_size': 4
            },
            course_kwargs={
                'students':
                list(itertools.chain([self.invitation_creator],
                                     self.to_invite))
            })
예제 #5
0
    def setUp(self):
        super().setUp()

        data = {
            'points_style':
            handgrading_models.PointsStyle.start_at_zero_and_add.value,
            'max_points': 20,
            'show_grades_and_rubric_to_students': True,
            'handgraders_can_leave_comments': True,
            'handgraders_can_adjust_points': True,
            'project': obj_build.build_project(),
        }

        self.handgrading_rubric = (
            handgrading_models.HandgradingRubric.objects.validate_and_create(
                **data))
        self.course = self.handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse('handgrading-rubric-detail',
                           kwargs={'pk': self.handgrading_rubric.pk})
    def setUp(self):
        super().setUp()
        self.handgrading_rubric = hg_models.HandgradingRubric.objects.validate_and_create(
            points_style=hg_models.PointsStyle.start_at_max_and_subtract,
            max_points=0,
            show_grades_and_rubric_to_students=False,
            handgraders_can_leave_comments=True,
            handgraders_can_adjust_points=True,
            project=obj_build.build_project())

        self.course = self.handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse('criteria',
                           kwargs={'handgrading_rubric_pk': self.handgrading_rubric.pk})

        self.data = {
            "short_description": "Sample short description.",
            "long_description": "Sample loooooooong description.",
            "points": 20,
        }
예제 #7
0
    def setUp(self):
        super().setUp()
        self.handgrading_rubric = handgrading_models.HandgradingRubric.objects.validate_and_create(
            points_style=handgrading_models.PointsStyle.
            start_at_max_and_subtract,
            max_points=0,
            show_grades_and_rubric_to_students=False,
            handgraders_can_leave_comments=False,
            handgraders_can_adjust_points=True,
            project=obj_build.build_project())

        submission = obj_build.make_submission(
            submitted_filenames=["test.cpp"])

        self.handgrading_result = handgrading_models.HandgradingResult.objects.validate_and_create(
            submission=submission,
            group=submission.group,
            handgrading_rubric=self.handgrading_rubric)

        comment_data = {
            "location": {
                "first_line": 0,
                "last_line": 1,
                "filename": "test.cpp"
            },
            "text": "Sample comment text.",
            "handgrading_result": self.handgrading_result
        }

        self.comment = handgrading_models.Comment.objects.validate_and_create(
            **comment_data)
        self.comment2 = handgrading_models.Comment.objects.validate_and_create(
            **comment_data)
        self.course = self.handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse('comment-detail', kwargs={'pk': self.comment.pk})

        [self.admin] = obj_build.make_admin_users(self.course, 1)
        [self.staff] = obj_build.make_staff_users(self.course, 1)
        [self.handgrader] = obj_build.make_handgrader_users(self.course, 1)
        [self.student] = obj_build.make_student_users(self.course, 1)
예제 #8
0
    def setUp(self):
        super().setUp()
        handgrading_rubric = handgrading_models.HandgradingRubric.objects.validate_and_create(
            points_style=handgrading_models.PointsStyle.
            start_at_max_and_subtract,
            max_points=0,
            show_grades_and_rubric_to_students=False,
            handgraders_can_leave_comments=True,
            handgraders_can_adjust_points=True,
            project=obj_build.build_project())

        self.annotation = handgrading_models.Annotation.objects.validate_and_create(
            short_description="Short description text.",
            long_description="Looooong description text.",
            deduction=-3,
            handgrading_rubric=handgrading_rubric)

        self.course = handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse('annotation-detail',
                           kwargs={'pk': self.annotation.pk})
예제 #9
0
    def setUp(self):
        super().setUp()
        handgrading_rubric = handgrading_models.HandgradingRubric.objects.validate_and_create(
            points_style=handgrading_models.PointsStyle.
            start_at_max_and_subtract,
            max_points=0,
            show_grades_and_rubric_to_students=False,
            handgraders_can_leave_comments=True,
            handgraders_can_adjust_points=True,
            project=obj_build.build_project())

        criterion = handgrading_models.Criterion.objects.validate_and_create(
            points=0, handgrading_rubric=handgrading_rubric)

        submission = obj_build.make_submission(
            submitted_filenames=["test.cpp"])

        self.handgrading_result = handgrading_models.HandgradingResult.objects.validate_and_create(
            submission=submission,
            group=submission.group,
            handgrading_rubric=handgrading_rubric)

        criterion_result_data = {
            "selected": True,
            "criterion": criterion,
            "handgrading_result": self.handgrading_result
        }

        self.criterion_result = handgrading_models.CriterionResult.objects.validate_and_create(
            **criterion_result_data)

        self.course = handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse('criterion-result-detail',
                           kwargs={'pk': self.criterion_result.pk})

        [self.admin] = obj_build.make_admin_users(self.course, 1)
        [self.handgrader] = obj_build.make_handgrader_users(self.course, 1)
        [self.staff] = obj_build.make_staff_users(self.course, 1)
        [self.enrolled] = obj_build.make_student_users(self.course, 1)
    def setUp(self):
        super().setUp()

        rubric = (
            handgrading_models.HandgradingRubric.objects.validate_and_create(
                points_style=handgrading_models.PointsStyle.start_at_max_and_subtract,
                max_points=10,
                show_grades_and_rubric_to_students=False,
                handgraders_can_leave_comments=True,
                handgraders_can_adjust_points=True,
                project=obj_build.build_project()
            )
        )

        self.default_location_dict = {
            "first_line": 0,
            "last_line": 1,
            "filename": "test.cpp"
        }

        self.annotation = handgrading_models.Annotation.objects.validate_and_create(
            handgrading_rubric=rubric)

        submission = obj_build.make_submission(submitted_filenames=["test.cpp"])

        self.default_handgrading_result_obj = (
            handgrading_models.HandgradingResult.objects.validate_and_create(
                submission=submission,
                group=submission.group,
                handgrading_rubric=rubric
            )
        )

        self.default_applied_annotation_inputs = {
            "location": self.default_location_dict,
            "annotation": self.annotation,
            "handgrading_result": self.default_handgrading_result_obj
        }
예제 #11
0
    def setUp(self):
        super().setUp()
        data = {
            'points_style':
            handgrading_models.PointsStyle.start_at_zero_and_add.value,
            'max_points': 20,
            'show_grades_and_rubric_to_students': True,
            'handgraders_can_leave_comments': True,
            'handgraders_can_adjust_points': True,
            'project': obj_build.build_project()
        }

        self.handgrading_rubric = (
            handgrading_models.HandgradingRubric.objects.validate_and_create(
                **data))

        for _ in range(3):
            handgrading_models.Criterion.objects.validate_and_create(
                short_description="sample short description",
                long_description="sample loooooong description",
                points=0,
                handgrading_rubric=self.handgrading_rubric)

        criterion_order = self.handgrading_rubric.get_criterion_order()[::-1]
        self.handgrading_rubric.set_criterion_order(criterion_order)

        for _ in range(3):
            handgrading_models.Annotation.objects.validate_and_create(
                handgrading_rubric=self.handgrading_rubric)

        annotation_order = self.handgrading_rubric.get_annotation_order()[::-1]
        self.handgrading_rubric.set_annotation_order(annotation_order)

        self.course = self.handgrading_rubric.project.course
        self.client = APIClient()
        self.url = reverse(
            'handgrading_rubric',
            kwargs={'project_pk': self.handgrading_rubric.project.pk})
예제 #12
0
    def test_valid_member_of_multiple_groups_for_different_projects(self):
        other_project = obj_build.build_project(
            project_kwargs={
                'max_group_size': 2,
                'guests_can_submit': True})

        repeated_user = self.student_users[0]

        first_group = ag_models.Group.objects.validate_and_create(
            members=self.student_users, project=self.project)

        second_group = ag_models.Group.objects.validate_and_create(
            members=[repeated_user], project=other_project)

        first_group.refresh_from_db()
        self.assertCountEqual(self.student_users, first_group.members.all())
        self.assertEqual(self.project, first_group.project)

        second_group.refresh_from_db()
        self.assertCountEqual([repeated_user], second_group.members.all())
        self.assertEqual(other_project, second_group.project)

        groups = list(repeated_user.groups_is_member_of.all())
        self.assertCountEqual([first_group, second_group], groups)
    def setUp(self):
        super().setUp()
        self.project = obj_build.build_project()

        self.valid_pattern = 'test_[0-4][!a-z]?.*.cpp'
예제 #14
0
 def setUp(self):
     self.project = obj_build.build_project()
예제 #15
0
 def test_serialize(self):
     project = obj_build.build_project()
     pattern = (ag_models.ExpectedStudentFile.objects.validate_and_create(
         pattern='spam', project=project))
     self.do_basic_serialize_test(
         pattern, ag_serializers.ExpectedStudentFileSerializer)
예제 #16
0
 def test_serialize(self):
     project = obj_build.build_project()
     data = self.do_basic_serialize_test(project,
                                         ag_serializers.ProjectSerializer)
     self.assertIn('closing_time', data)
예제 #17
0
    def project(self):
        if not hasattr(self, '_project'):
            self._project = obj_build.build_project(
                project_kwargs={'course': self.course})

        return self._project
    def setUp(self):
        super().setUp()

        self.project = obj_build.build_project()
        self.ag_suite = ag_models.AGTestSuite.objects.validate_and_create(
            name='suitey', project=self.project)  # type: ag_models.AGTestSuite