def test_is_not_active(self):
     SubjectBuilder.quickadd_ducku_duck1010()\
         .add_6month_lastyear_period()\
         .add_relatedstudents(self.testuser)
     response = self._get_as('testuser')
     self.assertEquals(response.status_code, 200)
     selector = htmls.S(response.content)
     self.assertFalse(
         selector.exists('#objecttableview-table tbody tr td:nth-child(1) '
                         'strong.devilry-student-allperiodsapp-isactive'))
Пример #2
0
 def setUp(self):
     self.testuser = UserBuilder('testuser').user
     self.testadmin = UserBuilder('testadmin').user
     self.subjectbuilder = SubjectBuilder.quickadd_ducku_duck1010()
     self.periodbuilder = self.subjectbuilder.add_6month_active_period()\
         .add_relatedstudents(self.testuser)
     self.relatedstudent = self.periodbuilder.period.relatedstudent_set.get(user=self.testuser)
    def test_filter_examiner_has_access(self):
        otherexaminer = UserBuilder('otherexaminer').user
        duck1010builder = SubjectBuilder.quickadd_ducku_duck1010()
        activeassignmentbuilder = duck1010builder.add_6month_active_period().add_assignment('week1')
        activedelivery = activeassignmentbuilder\
            .add_group(examiners=[self.examiner1])\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1).delivery

        # Add deliveries on inactive assignments and on a group with another examiner to make sure we get no false positives
        duck1010builder.add_6month_lastyear_period()\
            .add_assignment('week1')\
            .add_group(examiners=[self.examiner1])\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1)
        duck1010builder.add_6month_nextyear_period()\
            .add_assignment('week1')\
            .add_group(examiners=[self.examiner1])\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1)
        activeassignmentbuilder\
            .add_group(examiners=[otherexaminer])\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1)

        qry = Delivery.objects.filter_examiner_has_access(self.examiner1)
        self.assertEquals(qry.count(), 1)
        self.assertEquals(qry[0], activedelivery)

        # make sure we are not getting false positives
        self.assertEquals(Delivery.objects.filter_is_examiner(self.examiner1).count(), 3)
        self.assertEquals(Delivery.objects.filter_is_examiner(otherexaminer).count(), 1)
 def setUp(self):
     DeliveryBuilder.set_memory_deliverystore()
     self.examiner1 = UserBuilder('examiner1').user
     self.student1 = UserBuilder('student1', full_name="Student One").user
     self.duck1010builder = SubjectBuilder.quickadd_ducku_duck1010()
     self.week1builder = self.duck1010builder.add_6month_active_period()\
         .add_assignment('week1', long_name='Week 1')
Пример #5
0
 def test_filter_active(self):
     subjectbuilder = SubjectBuilder.quickadd_ducku_duck1010()
     active = subjectbuilder.add_6month_active_period().period
     subjectbuilder.add_6month_lastyear_period()
     subjectbuilder.add_6month_nextyear_period()
     self.assertEquals(
         list(Period.objects.filter_active()),
         [active])
 def setUp(self):
     self.admin1 = UserBuilder('admin1').user
     self.subjectbuilder = SubjectBuilder.quickadd_ducku_duck1010()
     self.periodbuilder = self.subjectbuilder.add_6month_active_period()
     self.assignmentbuilder = self.periodbuilder.add_assignment('myassignment')
     self.url = reverse('devilry_gradingsystem_admin_summary', kwargs={
         'assignmentid': self.assignmentbuilder.assignment.id,
     })
Пример #7
0
 def setUp(self):
     self.admin1 = UserBuilder('admin1').user
     self.subjectbuilder = SubjectBuilder.quickadd_ducku_duck1010()
     self.periodbuilder = self.subjectbuilder.add_6month_active_period()
     self.assignmentbuilder = self.periodbuilder.add_assignment(
         'myassignment')
     self.url = reverse('devilry_gradingsystem_admin_summary',
                        kwargs={
                            'assignmentid':
                            self.assignmentbuilder.assignment.id,
                        })
    def test_filter_is_active(self):
        duck1010builder = SubjectBuilder.quickadd_ducku_duck1010()
        activeassignmentbuilder = duck1010builder.add_6month_active_period().add_assignment('week1')

        # Add inactive groups to make sure we get no false positives
        duck1010builder.add_6month_lastyear_period().add_assignment('week1')
        duck1010builder.add_6month_nextyear_period().add_assignment('week1')

        qry = Assignment.objects.filter_is_active()
        self.assertEquals(qry.count(), 1)
        self.assertEquals(qry[0], activeassignmentbuilder.assignment)
Пример #9
0
    def test_filter_is_candidate_or_relatedstudent(self):
        subjectbuilder = SubjectBuilder.quickadd_ducku_duck1010()
        testuser = UserBuilder('testuser').user

        period_a_builder = subjectbuilder\
            .add_6month_active_period(short_name='periodA')\
            .add_relatedstudents(testuser)
        period_b_builder = subjectbuilder\
            .add_6month_active_period(short_name='periodB')
        period_b_builder\
            .add_assignment('week1')\
            .add_group(students=[testuser])
        subjectbuilder.add_6month_active_period(short_name='periodC')

        self.assertEquals(
            set(Period.objects.filter_is_candidate_or_relatedstudent(testuser)),
            {period_a_builder.period, period_b_builder.period})
    def test_filter_examiner_has_access(self):
        examiner1 = UserBuilder('examiner1').user
        otherexaminer = UserBuilder('otherexaminer').user
        duck1010builder = SubjectBuilder.quickadd_ducku_duck1010()
        activeassignmentbuilder = duck1010builder.add_6month_active_period().add_assignment('week1')
        activeassignmentbuilder.add_group().add_examiners(examiner1)

        # Add inactive groups and a group with another examiner to make sure we get no false positives
        duck1010builder.add_6month_lastyear_period().add_assignment('week1')\
            .add_group().add_examiners(examiner1)
        duck1010builder.add_6month_nextyear_period().add_assignment('week1')\
            .add_group().add_examiners(examiner1)
        activeassignmentbuilder.add_group().add_examiners(otherexaminer)

        qry = Assignment.objects.filter_examiner_has_access(examiner1)
        self.assertEquals(qry.count(), 1)
        self.assertEquals(qry[0], activeassignmentbuilder.assignment)

        # make sure we are not getting false positives
        self.assertEquals(Assignment.objects.filter_is_examiner(examiner1).count(), 3)
        self.assertEquals(Assignment.objects.filter_is_examiner(otherexaminer).count(), 1)
    def test_filter_is_active(self):
        duck1010builder = SubjectBuilder.quickadd_ducku_duck1010()
        activedelivery = duck1010builder.add_6month_active_period()\
            .add_assignment('week1')\
            .add_group()\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1).delivery

        # Add inactive groups to make sure we get no false positives
        duck1010builder.add_6month_lastyear_period()\
            .add_assignment('week1')\
            .add_group()\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1)
        duck1010builder.add_6month_nextyear_period()\
            .add_assignment('week1')\
            .add_group()\
            .add_deadline_in_x_weeks(weeks=1)\
            .add_delivery_x_hours_before_deadline(hours=1)

        self.assertEquals(len(Delivery.objects.all()), 3)
        qry = Delivery.objects.filter_is_active()
        self.assertEquals(qry.count(), 1)
        self.assertEquals(qry[0], activedelivery)