本文整理汇总了Python中devilry.project.develop.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.project.develop.testhelpers.corebuilder.PeriodBuilder
的用法示例。
在下文中一共展示了PeriodBuilder.quickadd_ducku_duck1010_active方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_relatedstudent
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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)
示例2: test_qualifies_for_final_exam_not_set
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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'))
示例3: test_is_active
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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'))
示例4: test_waiting_for_deliveries_only_owned
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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)
示例5: test_smart_create_non_electronic
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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)
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)
示例6: test_convert_multiple_to_delivery
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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']))
示例7: test_update
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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)
示例8: test_set_number_first
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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)
示例9: test_invite_email
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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)
示例10: test_groupinvite_allowed
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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'))
示例11: test_filter_admin_has_access_directly_on_assignment
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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)
示例12: test_create_deadline_changes_assignmentgroup_delivery_status
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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')
示例13: test_set_last_deadline_on_group_single
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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)
示例14: setUp
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.testhelpers.corebuilder.PeriodBuilder import quickadd_ducku_duck1010_active [as 别名]
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)
示例15: test_create_deadline_opens_assignmentgroup
# 需要导入模块: from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder [as 别名]
# 或者: from devilry.project.develop.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)