Exemplo n.º 1
0
    def test_students_on_the_semester_that_are_not_on_the_assignment_warning(self):
        assignment = mommy.make('core.Assignment')
        mommy.make('core.RelatedStudent', period=assignment.parentnode)
        related_student = mommy.make('core.RelatedStudent', period=assignment.parentnode)
        mommy.make('core.Candidate', relatedstudent=related_student, assignment_group__parentnode=assignment)
        mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=assignment)

        # Check warning exists
        self.assertTrue(mockresponse.selector.exists('#id_devilry_admin_assignment_student_on_semester_not_on_assignment'))

        # Check warning text
        self.assertIn(
            'note: There are students who are on the semester, but not on the assignment',
            mockresponse.selector.one('#id_devilry_admin_assignment_student_on_semester_not_on_assignment')
                .alltext_normalized)

        # Check warning link
        url = reverse_cradmin_url(
            instanceid='devilry_admin_assignmentadmin',
            appname='create_groups',
            viewname='INDEX',
            roleid=assignment.id)
        self.assertEqual(
            url,
            mockresponse.selector.one(
                '#id_devilry_admin_assignment_student_on_semester_not_on_assignment > a').get('href'))
Exemplo n.º 2
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_examiner_assignment',
         appname='grouplist',
         roleid=self.assignment.id,
         viewname=crapp.INDEXVIEW_NAME,
     )
Exemplo n.º 3
0
    def test_no_candidates_warning(self):
        assignment = mommy.make('core.Assignment')
        mommy.make('core.RelatedStudent', period=assignment.parentnode)
        mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=assignment)

        # Check warning exists
        self.assertTrue(mockresponse.selector.exists('#id_devilry_admin_assignment_student_no_students_on_assignment'))

        # Check warning texts
        self.assertIn(
            'warning: No students added to the assignment',
            mockresponse.selector.one('#id_devilry_admin_assignment_student_no_students_on_assignment')
                .alltext_normalized)
        self.assertIn(
            'Only students added to an assignment can see the assignment and add deliveries',
            mockresponse.selector.one('#id_devilry_admin_assignment_student_no_students_on_assignment')
                .alltext_normalized)

        # Check warning link
        url = reverse_cradmin_url(
            instanceid='devilry_admin_assignmentadmin',
            appname='create_groups',
            viewname='INDEX',
            roleid=assignment.id)
        self.assertEqual(
            url,
            mockresponse.selector.one(
                '#id_devilry_admin_assignment_student_no_students_on_assignment > strong > a').get('href'))
Exemplo n.º 4
0
    def test_fewer_examiners_than_relatedexaminers_on_semester_note(self):
        assignment = mommy.make_recipe('devilry.apps.core.assignment_activeperiod_end')
        mommy.make('core.RelatedExaminer', period=assignment.period)
        related_examiner = mommy.make('core.RelatedExaminer', period=assignment.period)
        mommy.make('core.Examiner', relatedexaminer=related_examiner, assignmentgroup__parentnode=assignment)
        mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=assignment)

        # Check warning exists
        self.assertTrue(
            mockresponse.selector.exists('#id_devilry_admin_assignment_examiner_on_semester_not_on_assignment'))

        # Check warning text
        self.assertIn(
            'note: There are examiners on the semester that are not assigned to any students',
            mockresponse.selector.one('#id_devilry_admin_assignment_examiner_on_semester_not_on_assignment')
                .alltext_normalized)

        # Check warning link
        url = reverse_cradmin_url(
            instanceid='devilry_admin_assignmentadmin',
            appname='examineroverview',
            viewname='INDEX',
            roleid=assignment.id)
        self.assertEqual(
            url,
            mockresponse.selector.one(
                '#id_devilry_admin_assignment_examiner_on_semester_not_on_assignment > a').get('href'))
Exemplo n.º 5
0
    def test_no_examiners_configured_for_assignment_groups_warning(self):
        assignment = mommy.make_recipe('devilry.apps.core.assignment_activeperiod_end')
        mommy.make('core.RelatedExaminer', period=assignment.period)
        mommy.make('core.Candidate', assignment_group__parentnode=assignment)
        mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=assignment)

        # Check warning exists
        self.assertTrue(
            mockresponse.selector.exists('#id_devilry_admin_assignment_examiner_no_examiners_on_assignment'))

        # Check warning texts
        self.assertIn(
            'warning: No examiners configured',
            mockresponse.selector.one('#id_devilry_admin_assignment_examiner_no_examiners_on_assignment')
                .alltext_normalized)
        self.assertIn(
            'Only configured examiners can see and correct deliveries from students.',
            mockresponse.selector.one('#id_devilry_admin_assignment_examiner_no_examiners_on_assignment')
                .alltext_normalized)

        # Check warning links
        url = reverse_cradmin_url(
            instanceid='devilry_admin_assignmentadmin',
            appname='examineroverview',
            viewname='INDEX',
            roleid=assignment.id)
        self.assertEqual(
            url,
            mockresponse.selector.one(
                '#id_devilry_admin_assignment_examiner_no_examiners_on_assignment > strong > a').get('href'))
    def test_render(self):
        deadlinebuilder = NodeBuilder.quickadd_ducku()\
            .add_subject(short_name='atestcourse', long_name='A Test Course')\
            .add_6month_active_period(short_name='testperiod', long_name='Test Period')\
            .add_assignment('testassignment', long_name='Test Assignment One')\
            .add_group(students=[self.testuser])\
            .add_deadline_in_x_weeks(weeks=1)
        deliverybuilder = deadlinebuilder.add_delivery_x_hours_before_deadline(hours=1)
        response = self._get_as('testuser')
        self.assertEquals(response.status_code, 200)
        selector = htmls.S(response.content)
        self.assertEquals(selector.count('#objecttableview-table tbody tr'), 1)

        self.assertEquals(
            selector.one('#objecttableview-table tbody tr td:nth-child(1) a').alltext_normalized,
            'Test Assignment One - Delivery#1')
        self.assertEquals(
            selector.one('#objecttableview-table tbody tr td:nth-child(1) a')['href'],
            crinstance.reverse_cradmin_url(
                instanceid='devilry_student_group',
                appname='deliveries',
                roleid=deliverybuilder.delivery.deadline.assignment_group_id,
                viewname='deliverydetails',
                kwargs={'pk': deliverybuilder.delivery.pk}))
        self.assertEquals(
            selector.one('#objecttableview-table tbody tr td:nth-child(2)').alltext_normalized,
            'A Test Course - Test Period')
        self.assertEquals(
            selector.one('#objecttableview-table tbody tr td:nth-child(3)').alltext_normalized,
            'atestcourse - testperiod')
        self.assertEquals(
            selector.one('#objecttableview-table tbody tr td:nth-child(4)').alltext_normalized,
            htmls.normalize_whitespace(naturaltime(deliverybuilder.delivery.time_of_delivery)))
Exemplo n.º 7
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='delete_groups',
         roleid=self.assignment.id,
         viewname='manual_select'
     )
Exemplo n.º 8
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_group_student',
         appname='feedbackfeed',
         roleid=self.group.id,
         viewname=crapp.INDEXVIEW_NAME,
     )
Exemplo n.º 9
0
 def test_post_success_redirect(self):
     created_subject, mockresponse = self.__valid_post_request()
     self.assertEqual(mockresponse.response['location'],
                      crinstance.reverse_cradmin_url(
                          instanceid='devilry_admin_subjectadmin',
                          appname='overview',
                          roleid=created_subject.id))
Exemplo n.º 10
0
    def test_students_without_examiners_exists_warning(self):
        assignment = mommy.make_recipe('devilry.apps.core.assignment_activeperiod_end')
        mommy.make('core.RelatedExaminer', period=assignment.period)
        mommy.make('core.Candidate', assignment_group__parentnode=assignment)
        mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=assignment)

        # Check warning exists
        self.assertTrue(
            mockresponse.selector.exists('#id_devilry_admin_assignment_examiner_students_without_examiner_warning'))

        # Check warning text
        self.assertIn(
            'warning: There are students with no examiners assigned to them',
            mockresponse.selector.one('#id_devilry_admin_assignment_examiner_students_without_examiner_warning')
                .alltext_normalized)

        # Check warning link
        url = reverse_cradmin_url(
            instanceid='devilry_admin_assignmentadmin',
            appname='examineroverview',
            roleid=assignment.id,
            viewname='INDEX'
        )
        self.assertEqual(
            url,
            mockresponse.selector.one(
                '#id_devilry_admin_assignment_examiner_students_without_examiner_warning > strong > a').get('href'))
Exemplo n.º 11
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='passed_previous_period',
         roleid=self.roleid,
         viewname='select_period'
     )
Exemplo n.º 12
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_periodadmin',
         appname='overview',
         roleid=self.period.id,
         viewname=crapp.INDEXVIEW_NAME
     )
Exemplo n.º 13
0
 def get_backlink_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_group_examiner',
         appname='feedbackfeed',
         roleid=self.kwargs.get('group_id'),
         viewname=crapp.INDEXVIEW_NAME
     )
Exemplo n.º 14
0
 def get_success_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='studentoverview',
         roleid=self.request.cradmin_instance.assignment.id,
         viewname=crapp.INDEXVIEW_NAME
     )
Exemplo n.º 15
0
 def test_status_corrected_passed(self):
     deliverybuilder = self.groupbuilder.add_deadline_in_x_weeks(weeks=1)\
         .add_delivery_x_hours_before_deadline(hours=1)
     deliverybuilder.add_feedback(saved_by=UserBuilder('testexaminer').user,
                                  grade='10/20',
                                  is_passing_grade=True,
                                  points=20)
     self.groupbuilder.add_students(self.testuser)
     self.assertEquals(self.groupbuilder.group.get_status(), 'corrected')
     response = self._get_as('testuser')
     response.render()
     selector = htmls.S(response.content)
     self.assertTrue(selector.exists('.devilry-student-groupoverview-corrected'))
     self.assertTrue(selector.exists('.devilry-student-groupoverview-corrected-passed'))
     self.assertTrue(selector.exists
                     ('.django-cradmin-container-fluid-focus.django-cradmin-container-fluid-focus-success'))
     self.assertEquals(
         selector.one('.devilry-student-groupoverview-corrected').alltext_normalized,
         'This assignment is corrected, and the final grade is: 10/20 (passed)')
     self.assertEquals(
         selector.one('.devilry-student-groupoverview-corrected a')['href'],
         reverse_cradmin_url(
             instanceid='devilry_student_group',
             appname='deliveries',
             roleid=self.groupbuilder.group.id,
             viewname='deliverydetails',
             kwargs={'pk': deliverybuilder.delivery.id}))
Exemplo n.º 16
0
 def get_success_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_periodadmin',
         appname='manage_tags',
         roleid=self.request.cradmin_role.id,
         viewname=crapp.INDEXVIEW_NAME
     )
Exemplo n.º 17
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='delete_groups',
         roleid=self.current_assignment.id,
         viewname='confirm_delete',
         kwargs={'from_assignment_id': self.assignment.id}
     )
Exemplo n.º 18
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='groupdetails',
         roleid=self.kwargs['assignment'].id,
         viewname='groupdetails',
         kwargs={'pk': self.group.id}
     )
Exemplo n.º 19
0
 def get_actionurl(self, delivery):
     return crinstance.reverse_cradmin_url(
         instanceid='devilry_student_group',
         appname='deliveries',
         roleid=delivery.deadline.assignment_group_id,
         viewname='deliverydetails',
         kwargs={'pk': delivery.pk}
     )
 def _get_as(self, username, deliveryid):
     self.client.login(username=username, password='test')
     return self.client.get(reverse_cradmin_url(
         instanceid='devilry_student_group',
         appname='deliveries',
         roleid=self.groupbuilder.group.id,
         viewname='deliverydetails',
         kwargs={'pk': deliveryid}))
Exemplo n.º 21
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_assignmentadmin',
         appname='examinerdetails',
         roleid=self.kwargs['assignment'].id,
         viewname=crapp.INDEXVIEW_NAME,
         kwargs={'relatedexaminer_id': self.relatedexaminer.id}
     )
Exemplo n.º 22
0
 def _postas(self, group_id, user, *args, **kwargs):
     self.client.login(username=user.shortname, password='test')
     url = reverse_cradmin_url(
         instanceid='devilry_student_group',
         appname='projectgroup',
         roleid=group_id
     )
     return self.client.post(url, *args, **kwargs)
Exemplo n.º 23
0
 def test_post_success_redirect(self):
     self.assertEqual(Period.objects.count(), 0)
     created_period, mockresponse = self.__valid_post_request()
     self.assertEqual(mockresponse.response['location'],
                      crinstance.reverse_cradmin_url(
                          instanceid='devilry_admin_periodadmin',
                          appname='overview',
                          roleid=created_period.id))
Exemplo n.º 24
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin',
         appname='studentfeedbackfeedwizard',
         viewname='student_groups',
         kwargs={
             'user_id': self.user.id
         }
     )
Exemplo n.º 25
0
 def test_post_success_redirect(self):
     self.assertEqual(Assignment.objects.count(), 0)
     created_assignment, mockresponse = self.__valid_post_request(first_deadline=ACTIVE_PERIOD_END)
     self.assertEqual(
         mockresponse.response["location"],
         crinstance.reverse_cradmin_url(
             instanceid="devilry_admin_assignmentadmin", appname="overview", roleid=created_assignment.id
         ),
     )
 def add_role_menuitem_object(self, active=False):
     self.add_headeritem_object(devilry_crmenu.BreadcrumbMenuItem(
         label=ugettext_lazy('Account'),
         url=reverse_cradmin_url(
             instanceid='devilry_account',
             appname='account'
         ),
         active=active
     ))
Exemplo n.º 27
0
 def _getas(self, group_id, invite_id, user, *args, **kwargs):
     self.client.login(username=user.shortname, password='test')
     url = reverse_cradmin_url(
         instanceid='devilry_student_group',
         appname='projectgroup',
         roleid=group_id,
         viewname='delete',
         kwargs={'invite_id': invite_id}
     )
     return self.client.get(url, *args, **kwargs)
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_periodadmin',
         appname='qualifiesforexam',
         roleid=self.roleid,
         viewname='configure-plugin',
         kwargs={
             'plugintypeid': self.plugin.get_plugintypeid(),
         }
     )
Exemplo n.º 29
0
 def get_url(self):
     return reverse_cradmin_url(
         instanceid='devilry_admin_periodadmin',
         roleid=self.status.period.id,
         appname='qualifiesforexam',
         viewname='show-status',
         kwargs={
             'statusid': self.status.id
         }
     )
Exemplo n.º 30
0
 def add_assignment_breadcrumb_item(self, assignment, active=False):
     return self.add_headeritem_object(devilry_crmenu.BreadcrumbMenuItem(
         label=assignment.short_name,
         url=reverse_cradmin_url(
             instanceid='devilry_admin_assignmentadmin',
             appname='overview',
             roleid=assignment.id,
             viewname=crapp.INDEXVIEW_NAME,
         ),
         active=active
     ))