Beispiel #1
0
    def test_toggle_no_grades(self):
        course = mommy.make(Course,
            name_en="Toggle",
            vote_start_date=datetime.date.today(),
            state="reviewed",
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ]
        )
        contribution = Contribution(course=course, contributor=UserProfile.objects.get(username="******"), responsible=True)
        contribution.save()
        contribution.questionnaires = [mommy.make(Questionnaire, is_for_contributors=True)]

        course.general_contribution.questionnaires = [mommy.make(Questionnaire)]

        toggle_url = "/grades/semester/"+str(course.semester.id)+"/course/"+str(course.id)+"/togglenogrades"

        self.assertFalse(course.gets_no_grade_documents)

        self.get_submit_assert_302(toggle_url, "grade_publisher")
        course = Course.objects.get(id=course.id)
        self.assertTrue(course.gets_no_grade_documents)
        # course should get published here
        self.assertEqual(course.state, "published")
        self.assertEqual(len(mail.outbox), course.num_participants + course.contributions.exclude(contributor=None).count())

        self.get_submit_assert_302(toggle_url, "grade_publisher")
        course = Course.objects.get(id=course.id)
        self.assertFalse(course.gets_no_grade_documents)
Beispiel #2
0
    def setUpTestData(cls):
        mommy.make(UserProfile, username="******", groups=[Group.objects.get(name="Grade publisher")])
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")

        course = mommy.make(Course,
            name_en="Test",
            vote_start_date=datetime.date.today(),
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ]
        )
        contribution = Contribution(course=course, contributor=UserProfile.objects.get(username="******"), responsible=True)
        contribution.save()
        contribution.questionnaires = [mommy.make(Questionnaire, is_for_contributors=True)]

        course.general_contribution.questionnaires = [mommy.make(Questionnaire)]

        semester_grade_activation = SemesterGradeDownloadActivation(semester=course.semester, is_active=True)
        semester_grade_activation.save()
Beispiel #3
0
    def test_toggle_no_grades(self):
        course = mommy.make(Course,
            name_en="Toggle",
            vote_start_date=datetime.date.today(),
            state="reviewed",
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ]
        )
        contribution = Contribution(course=course, contributor=UserProfile.objects.get(username="******"), responsible=True, can_edit=True, comment_visibility=Contribution.ALL_COMMENTS)
        contribution.save()
        contribution.questionnaires = [mommy.make(Questionnaire, is_for_contributors=True)]

        course.general_contribution.questionnaires = [mommy.make(Questionnaire)]

        self.assertFalse(course.gets_no_grade_documents)

        response = self.app.post("/grades/toggle_no_grades", {"course_id": course.id}, user="******")
        self.assertEqual(response.status_code, 200)
        course = Course.objects.get(id=course.id)
        self.assertTrue(course.gets_no_grade_documents)
        # course should get published here
        self.assertEqual(course.state, "published")
        self.assertEqual(len(mail.outbox), course.num_participants + course.contributions.exclude(contributor=None).count())

        response = self.app.post("/grades/toggle_no_grades", {"course_id": course.id}, user="******")
        self.assertEqual(response.status_code, 200)
        course = Course.objects.get(id=course.id)
        self.assertFalse(course.gets_no_grade_documents)
Beispiel #4
0
    def setUpTestData(cls):
        mommy.make(UserProfile, username="******", groups=[Group.objects.get(name="Grade publisher")])
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")
        mommy.make(UserProfile, username="******", email="*****@*****.**")

        course = mommy.make(Course,
            name_en="Test",
            vote_start_date=datetime.date.today(),
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ]
        )
        contribution = Contribution(course=course, contributor=UserProfile.objects.get(username="******"), responsible=True)
        contribution.save()
        contribution.questionnaires = [mommy.make(Questionnaire, is_for_contributors=True)]

        course.general_contribution.questionnaires = [mommy.make(Questionnaire)]
Beispiel #5
0
    def test_toggle_no_grades(self):
        course = mommy.make(Course,
            name_en="Toggle",
            vote_start_date=datetime.date.today(),
            state="reviewed",
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ]
        )
        contribution = Contribution(course=course, contributor=UserProfile.objects.get(username="******"), responsible=True)
        contribution.save()
        contribution.questionnaires = [mommy.make(Questionnaire, is_for_contributors=True)]

        course.general_contribution.questionnaires = [mommy.make(Questionnaire)]

        toggle_url = "/grades/semester/"+str(course.semester.id)+"/course/"+str(course.id)+"/togglenogrades"

        self.assertFalse(course.gets_no_grade_documents)

        self.get_submit_assert_302(toggle_url, "grade_publisher")
        course = Course.objects.get(id=course.id)
        self.assertTrue(course.gets_no_grade_documents)
        # course should get published here
        self.assertEqual(course.state, "published")
        self.assertEqual(len(mail.outbox), course.num_participants + course.contributions.exclude(contributor=None).count())

        self.get_submit_assert_302(toggle_url, "grade_publisher")
        course = Course.objects.get(id=course.id)
        self.assertFalse(course.gets_no_grade_documents)
Beispiel #6
0
    def test_toggle_no_grades(self):
        course = mommy.make(Course,
                            name_en="Toggle",
                            vote_start_date=datetime.date.today(),
                            state="reviewed",
                            participants=[
                                UserProfile.objects.get(username="******"),
                                UserProfile.objects.get(username="******"),
                                UserProfile.objects.get(username="******"),
                            ],
                            voters=[
                                UserProfile.objects.get(username="******"),
                                UserProfile.objects.get(username="******"),
                            ])
        contribution = Contribution(
            course=course,
            contributor=UserProfile.objects.get(username="******"),
            responsible=True,
            can_edit=True,
            comment_visibility=Contribution.ALL_COMMENTS)
        contribution.save()
        contribution.questionnaires = [
            mommy.make(Questionnaire, is_for_contributors=True)
        ]

        course.general_contribution.questionnaires = [
            mommy.make(Questionnaire)
        ]

        self.assertFalse(course.gets_no_grade_documents)

        response = self.app.post("/grades/toggle_no_grades",
                                 {"course_id": course.id},
                                 user="******")
        self.assertEqual(response.status_code, 200)
        course = Course.objects.get(id=course.id)
        self.assertTrue(course.gets_no_grade_documents)
        # course should get published here
        self.assertEqual(course.state, "published")
        self.assertEqual(
            len(mail.outbox), course.num_participants +
            course.contributions.exclude(contributor=None).count())

        response = self.app.post("/grades/toggle_no_grades",
                                 {"course_id": course.id},
                                 user="******")
        self.assertEqual(response.status_code, 200)
        course = Course.objects.get(id=course.id)
        self.assertFalse(course.gets_no_grade_documents)
Beispiel #7
0
    def setUpTestData(cls):
        mommy.make(UserProfile,
                   username="******",
                   groups=[Group.objects.get(name="Grade publisher")])
        mommy.make(UserProfile,
                   username="******",
                   email="*****@*****.**")
        mommy.make(UserProfile,
                   username="******",
                   email="*****@*****.**")
        mommy.make(UserProfile,
                   username="******",
                   email="*****@*****.**")
        responsible = mommy.make(UserProfile,
                                 username="******",
                                 email="*****@*****.**")

        cls.course = mommy.make(
            Course,
            name_en="Test",
            vote_start_date=datetime.date.today(),
            participants=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ],
            voters=[
                UserProfile.objects.get(username="******"),
                UserProfile.objects.get(username="******"),
            ])
        contribution = Contribution(
            course=cls.course,
            contributor=responsible,
            responsible=True,
            can_edit=True,
            comment_visibility=Contribution.ALL_COMMENTS)
        contribution.save()
        contribution.questionnaires = [
            mommy.make(Questionnaire, is_for_contributors=True)
        ]

        cls.course.general_contribution.questionnaires = [
            mommy.make(Questionnaire)
        ]

        cls.activation = SemesterGradeDownloadActivation.objects.create(
            semester=cls.course.semester, is_active=True)