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


Python PeriodBuilder.quickadd_ducku_duck1010_active方法代码示例

本文整理汇总了Python中devilry_developer.testhelpers.corebuilder.PeriodBuilder.quickadd_ducku_duck1010_active方法的典型用法代码示例。如果您正苦于以下问题:Python PeriodBuilder.quickadd_ducku_duck1010_active方法的具体用法?Python PeriodBuilder.quickadd_ducku_duck1010_active怎么用?Python PeriodBuilder.quickadd_ducku_duck1010_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在devilry_developer.testhelpers.corebuilder.PeriodBuilder的用法示例。


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

示例1: test_smart_create_non_electronic

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
    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)
        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)
        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:unioslo,项目名称:devilry-django,代码行数:34,代码来源:deadline.py

示例2: test_invite_email

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
    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:unioslo,项目名称:devilry-django,代码行数:27,代码来源:groupinvite.py

示例3: test_set_last_deadline_on_group_single

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 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:unioslo,项目名称:devilry-django,代码行数:10,代码来源:deadline.py

示例4: test_create_deadline_changes_assignmentgroup_delivery_status

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 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:unioslo,项目名称:devilry-django,代码行数:10,代码来源:deadline.py

示例5: test_create_deadline_opens_assignmentgroup

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 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:unioslo,项目名称:devilry-django,代码行数:10,代码来源:deadline.py

示例6: test_filter_admin_has_access_directly_on_assignment

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 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:unioslo,项目名称:devilry-django,代码行数:10,代码来源:assignment.py

示例7: test_points_to_grade_points

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_points_to_grade_points(self):
     assignment1 = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1',
             points_to_grade_mapper='raw-points',
             max_points=10).assignment
     self.assertEquals(assignment1.points_to_grade(0), '0/10')
     self.assertEquals(assignment1.points_to_grade(1), '1/10')
     self.assertEquals(assignment1.points_to_grade(10), '10/10')
开发者ID:unioslo,项目名称:devilry-django,代码行数:10,代码来源:assignment.py

示例8: test_only_groupmember_can_invite

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_only_groupmember_can_invite(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
     with self.assertRaisesRegexp(ValidationError,
             r'^.*The user sending an invite must be a Candiate on the group.*$'):
         GroupInvite(group=group, sent_by=self.testuser2, sent_to=self.testuser3).clean()
开发者ID:unioslo,项目名称:devilry-django,代码行数:11,代码来源:groupinvite.py

示例9: test_can_not_invite_self

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_can_not_invite_self(self):
     group = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_relatedstudents(self.testuser1)\
         .add_assignment('assignment1',
             students_can_create_groups=True)\
         .add_group(students=[self.testuser1]).group
     with self.assertRaisesRegexp(ValidationError,
             r'^.*The student is already a member of the group.*$'):
         GroupInvite(group=group, sent_by=self.testuser1, sent_to=self.testuser1).clean()
开发者ID:unioslo,项目名称:devilry-django,代码行数:11,代码来源:groupinvite.py

示例10: test_autocreate_delivery_if_nonelectronic_false

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_autocreate_delivery_if_nonelectronic_false(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1',
             delivery_types=deliverytypes.NON_ELECTRONIC)\
         .add_group()
     deadline = Deadline(
         assignment_group=groupbuilder.group,
         deadline=DateTimeBuilder.now().plus(days=10))
     deadline.save(autocreate_delivery_if_nonelectronic=False)
     self.assertEquals(deadline.deliveries.count(), 0)
开发者ID:unioslo,项目名称:devilry-django,代码行数:12,代码来源:deadline.py

示例11: test_can_not_invite_someone_that_already_has_invite_for_group

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_can_not_invite_someone_that_already_has_invite_for_group(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
     GroupInvite(group=group, sent_by=self.testuser1, sent_to=self.testuser2).save()
     with self.assertRaisesRegexp(ValidationError,
             r'^.*The student is already invited to join the group, but they have not responded yet.*$'):
         GroupInvite(group=group, sent_by=self.testuser1, sent_to=self.testuser2).clean()
开发者ID:unioslo,项目名称:devilry-django,代码行数:12,代码来源:groupinvite.py

示例12: test_autocreate_delivery_if_nonelectronic

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_autocreate_delivery_if_nonelectronic(self):
     groupbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1',
             delivery_types=deliverytypes.NON_ELECTRONIC)\
         .add_group()
     deadline = groupbuilder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=10))
     self.assertEquals(deadline.deliveries.count(), 1)
     self.assertTrue(deadline.deliveries.all()[0].successful)
     groupbuilder.reload_from_db()
     self.assertEquals(groupbuilder.group.last_delivery, deadline.deliveries.all()[0])
开发者ID:unioslo,项目名称:devilry-django,代码行数:12,代码来源:deadline.py

示例13: test_filter_is_examiner

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
    def test_filter_is_examiner(self):
        examiner1 = UserBuilder('examiner1').user
        week1builder = PeriodBuilder.quickadd_ducku_duck1010_active().add_assignment('week1')
        group1builder = week1builder.add_group().add_examiners(examiner1)

        # Add another group to make sure we do not get false positives
        week1builder.add_group().add_examiners(UserBuilder('examiner2').user)

        qry = Assignment.objects.filter_is_examiner(examiner1)
        self.assertEquals(qry.count(), 1)
        self.assertEquals(qry[0], week1builder.assignment)
开发者ID:unioslo,项目名称:devilry-django,代码行数:13,代码来源:assignment.py

示例14: test_set_last_deadline_on_group_merge

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_set_last_deadline_on_group_merge(self):
     assignmentbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1')
     group1builder = assignmentbuilder.add_group()
     group2builder = assignmentbuilder.add_group()
     deadline2 = group2builder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=10))
     deadline3 = group1builder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=15))
     deadline1 = group1builder.group.deadlines.create(deadline=DateTimeBuilder.now().plus(days=5))
     group2builder.group.merge_into(group1builder.group)
     group1builder.reload_from_db()
     self.assertEquals(group1builder.group.last_deadline, deadline3)
开发者ID:unioslo,项目名称:devilry-django,代码行数:13,代码来源:deadline.py

示例15: test_smart_create_no_text

# 需要导入模块: from devilry_developer.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry_developer.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
 def test_smart_create_no_text(self):
     assignmentbuilder = PeriodBuilder.quickadd_ducku_duck1010_active()\
         .add_assignment('assignment1')
     group1builder = assignmentbuilder.add_group()
     deadline_datetime = Deadline.reduce_datetime_precision(DateTimeBuilder.now().plus(days=10))
     Deadline.objects.smart_create(
         assignmentbuilder.assignment.assignmentgroups.all(),
         deadline_datetime=deadline_datetime)
     group1builder.reload_from_db()
     self.assertEquals(group1builder.group.last_deadline.deadline, deadline_datetime)
     self.assertEquals(group1builder.group.last_deadline.text, None)
开发者ID:unioslo,项目名称:devilry-django,代码行数:13,代码来源:deadline.py


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