当前位置: 首页>>代码示例>>Python>>正文


Python corebuilder.PeriodBuilder类代码示例

本文整理汇总了Python中devilry.project.develop.testhelpers.corebuilder.PeriodBuilder的典型用法代码示例。如果您正苦于以下问题:Python PeriodBuilder类的具体用法?Python PeriodBuilder怎么用?Python PeriodBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PeriodBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_relatedstudent

 def test_is_relatedstudent(self):
     PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_relatedstudents(self.testuser)
     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)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:7,代码来源:test_allperiodsapp.py

示例2: test_qualifies_for_final_exam_not_set

 def test_qualifies_for_final_exam_not_set(self):
     PeriodBuilder.quickadd_ducku_duck1010_active()\
         .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) '
                         '.devilry-student-allperiodsapp-qualified-for-final-exam-wrapper'))
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:9,代码来源:test_allperiodsapp.py

示例3: test_is_active

 def test_is_active(self):
     PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_relatedstudents(self.testuser)
     response = self._get_as('testuser')
     self.assertEquals(response.status_code, 200)
     selector = htmls.S(response.content)
     self.assertTrue(
         selector.exists('#objecttableview-table tbody tr td:nth-child(1) '
                         'strong.devilry-student-allperiodsapp-isactive'))
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:9,代码来源:test_allperiodsapp.py

示例4: test_waiting_for_deliveries_only_owned

 def test_waiting_for_deliveries_only_owned(self):
     PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('testassignment')\
         .add_group(students=[UserBuilder('otheruser').user])\
         .add_deadline_in_x_weeks(weeks=1)\
         .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'), 0)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:10,代码来源:test_waitingfordeliveriesapp.py

示例5: test_smart_create_non_electronic

    def test_smart_create_non_electronic(self):
        assignment = PeriodBuilder.quickadd_ducku_duck1010_active()\
            .add_assignment('assignment1', delivery_types=deliverytypes.NON_ELECTRONIC).assignment
        group1 = AssignmentGroup(parentnode=assignment)
        group2 = AssignmentGroup(parentnode=assignment)
        for group in group1, group2:
            group.save(autocreate_first_deadline_for_nonelectronic=False)
        deadline_datetime = Deadline.reduce_datetime_precision(DateTimeBuilder.now().plus(days=10))
        result = Deadline.objects.smart_create(
            assignment.assignmentgroups.all(),
            deadline_datetime=deadline_datetime,
            text='Hello world')
        self.assertIsNone(result)
        self.assertEquals(group1.deadlines.count(), 1)

        group1 = AssignmentGroup.objects.get(id=group1.id) # Reload from db
        created_deadline = group1.deadlines.all()[0]
        self.assertEquals(created_deadline.deadline, deadline_datetime)
        self.assertEquals(created_deadline.text, 'Hello world')
        self.assertEquals(group1.last_deadline, created_deadline)
        self.assertEquals(group1.last_deadline.deliveries.count(), 1)
        group1_last_delivery = Delivery.objects.filter(deadline__assignment_group=group1).first()
        self.assertEquals(group1.last_deadline.deliveries.all()[0], group1_last_delivery)
        self.assertTrue(group1_last_delivery.successful)
        self.assertEquals(group1_last_delivery.number, 1)

        group2 = AssignmentGroup.objects.get(id=group2.id) # Reload from db
        self.assertEquals(group2.deadlines.all()[0].deadline, deadline_datetime)
        self.assertEquals(group2.last_deadline, group2.deadlines.all()[0])
        self.assertEquals(group2.last_deadline.deliveries.count(), 1)
        group2_last_delivery = Delivery.objects.filter(deadline__assignment_group=group2).first()
        self.assertEquals(group2.last_deadline.deliveries.all()[0], group2_last_delivery)
        self.assertTrue(group2_last_delivery.successful)
        self.assertEquals(group2_last_delivery.number, 1)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:34,代码来源:test_deadline.py

示例6: test_convert_multiple_to_delivery

 def test_convert_multiple_to_delivery(self):
     deadline = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('week1')\
         .add_group(students=[self.testuser])\
         .add_deadline_x_weeks_ago(weeks=1).deadline
     UploadedDeliveryFile.objects.create_with_file(
         user=self.testuser,
         deadline=deadline,
         filename='testing.txt',
         filecontent=ContentFile('Hello world')
     )
     UploadedDeliveryFile.objects.create_with_file(
         user=self.testuser,
         deadline=deadline,
         filename='testing2.txt',
         filecontent=ContentFile('Hello world 2')
     )
     delivery, files = UploadedDeliveryFile.objects.convert_to_delivery(deadline, self.testuser)
     self.assertEquals(delivery.filemetas.count(), 2)
     self.assertEquals(
         set([f.filename for f in delivery.filemetas.all()]),
         set(['testing.txt', 'testing2.txt']))
     self.assertEquals(
         set([f.get_all_data_as_string() for f in delivery.filemetas.all()]),
         set(['Hello world', 'Hello world 2']))
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:25,代码来源:test_models.py

示例7: test_update

    def test_update(self):
        periodbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
            .add_admins(self.testuser)

        publishing_time = DateTimeBuilder.now().plus(days=10)
        assignment1builder = periodbuilder.add_assignment('assignment1',
            long_name='Assignment One',
            anonymous=True,
            publishing_time=publishing_time,
            deadline_handling=1,
            max_points=10, # Should not be touched by the update
            passing_grade_min_points=8 # Should not be touched by the update
        )

        new_publishing_time = DateTimeBuilder.now().plus(days=20).replace(second=0, microsecond=0, tzinfo=None)
        response = self._postas(assignment1builder.assignment.id, self.testuser, {
            'long_name': 'Test One',
            'short_name': 'test1',
            'anonymous': '',
            'publishing_time': isoformat_datetime(new_publishing_time),
            'deadline_handling': 0
        })
        self.assertEquals(response.status_code, 302)
        assignment1builder.reload_from_db()
        assignment = assignment1builder.assignment
        self.assertEquals(assignment.long_name, 'Test One')
        self.assertEquals(assignment.short_name, 'test1')
        self.assertFalse(assignment.anonymous)
        self.assertEquals(assignment.publishing_time, new_publishing_time)
        self.assertEquals(assignment.deadline_handling, 0)
        self.assertEquals(assignment.max_points, 10)
        self.assertEquals(assignment.passing_grade_min_points, 8)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:32,代码来源:test_assignment_update.py

示例8: test_set_number_first

 def test_set_number_first(self):
     deadline = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('week1').add_group()\
         .add_deadline_x_weeks_ago(weeks=1).deadline
     delivery = Delivery(deadline=deadline)
     delivery.set_number()
     self.assertEqual(delivery.number, 1)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:7,代码来源:test_delivery.py

示例9: test_invite_email

    def test_invite_email(self):
        group = PeriodBuilder.quickadd_ducku_duck1010_active()\
            .add_relatedstudents(self.testuser2)\
            .add_assignment('assignment1', students_can_create_groups=True)\
            .add_group(students=[self.testuser1]).group
        invite = group.groupinvite_set.create(
            sent_by=self.testuser1,
            sent_to=self.testuser2)
        self.assertEqual(len(mail.outbox), 0)

        class FakeRequest(object):
            def build_absolute_uri(self, location):
                return 'http://example.com{}'.format(location)

        invite.send_invite_notification(FakeRequest())
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].to, ['[email protected]'])
        self.assertEqual(mail.outbox[0].subject, '[Devilry] Project group invite for duck1010.active.assignment1')
        self.assertIn(
            u'testuser1 invited you to join their project\ngroup for duck1010 assignment1.',
            mail.outbox[0].body)
        self.assertIn(
            'http://example.com{}'.format(reverse('devilry_student_groupinvite_respond',
                kwargs={'invite_id': invite.id})),
            mail.outbox[0].body)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:25,代码来源:test_groupinvite.py

示例10: test_groupinvite_allowed

 def test_groupinvite_allowed(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1', students_can_create_groups=True)\
         .add_group(students=[self.testuser])
     groupbuilder.add_deadline_in_x_weeks(weeks=1)
     html = self._getas(groupbuilder.group.id, self.testuser).content
     self.assertTrue(cssExists(html, '#devilry_student_projectgroupoverview_invitebox'))
开发者ID:Nasmi1,项目名称:devilry-django,代码行数:7,代码来源:test_projectgroupapp.py

示例11: test_filter_admin_has_access_directly_on_assignment

 def test_filter_admin_has_access_directly_on_assignment(self):
     admin1 = UserBuilder('admin1').user
     periodbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()
     assignment1 = periodbuilder.add_assignment('assignment1').add_admins(admin1).assignment
     periodbuilder.add_assignment('assignment2')
     qry = Assignment.objects.filter_admin_has_access(admin1)
     self.assertEquals(qry.count(), 1)
     self.assertEquals(qry[0], assignment1)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:8,代码来源:test_assignment.py

示例12: test_create_deadline_changes_assignmentgroup_delivery_status

 def test_create_deadline_changes_assignmentgroup_delivery_status(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1')\
         .add_group()
     self.assertEquals(groupbuilder.group.delivery_status, 'no-deadlines')
     groupbuilder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=3))
     groupbuilder.reload_from_db()
     self.assertEquals(groupbuilder.group.delivery_status, 'waiting-for-something')
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:8,代码来源:test_deadline.py

示例13: test_set_last_deadline_on_group_single

 def test_set_last_deadline_on_group_single(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1')\
         .add_group()
     self.assertIsNone(groupbuilder.group.last_deadline)
     deadline = groupbuilder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=3))
     groupbuilder.reload_from_db()
     self.assertEquals(groupbuilder.group.last_deadline, deadline)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:8,代码来源:test_deadline.py

示例14: setUp

 def setUp(self):
     self.testuser = UserBuilder('testuser').user
     self.factory = RequestFactory()
     self.periodbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()
     self.assignmentbuilder = self.periodbuilder.add_assignment('testassignment')
     self.groupbuilder = self.assignmentbuilder.add_group()
     self.groupbuilder.add_deadline_in_x_weeks(weeks=1)
     self.groupbuilder.add_students(self.testuser)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:8,代码来源:test_contactapp.py

示例15: test_create_deadline_opens_assignmentgroup

 def test_create_deadline_opens_assignmentgroup(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1')\
         .add_group()
     groupbuilder.update(is_open=False)
     groupbuilder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=3))
     groupbuilder.reload_from_db()
     self.assertTrue(groupbuilder.group.is_open)
开发者ID:KorshakVladimir,项目名称:devilry-django,代码行数:8,代码来源:test_deadline.py


注:本文中的devilry.project.develop.testhelpers.corebuilder.PeriodBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。