本文整理汇总了Python中student.tests.factories.UserFactory.reset_sequence方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.reset_sequence方法的具体用法?Python UserFactory.reset_sequence怎么用?Python UserFactory.reset_sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student.tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.reset_sequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from student.tests.factories import UserFactory [as 别名]
# 或者: from student.tests.factories.UserFactory import reset_sequence [as 别名]
def setUp(self):
start_date = datetime.datetime(2000, 1, 1, tzinfo=UTC())
end_date = datetime.datetime(2010, 12, 31, tzinfo=UTC())
#self.course = CourseFactory.create(
# org='org', number='num', run='run', display_name='test_course',
# start=start_date, end=end_date)
for i in xrange(1, 10):
random = i * randint(1, 100)
try:
self.course = CourseFactory.create(
org='org_' + str(random), number='num', run="run", display_name='test_course',
start=start_date, end=end_date)
break
except DuplicateCourseError:
print "wow"
UserFactory.reset_sequence()
self.students = UserFactory.create_batch(3)
for student in self.students:
CourseEnrollmentFactory.create(
user=student, course_id=self.course.id)
self.course.save()
self.prog_name = "create_certs"
self.args_create = ["create", self.course.id.to_deprecated_string()]
self.args_delete = ["delete", self.course.id.to_deprecated_string()]
self.args_report = ["report", self.course.id.to_deprecated_string()]
self.args_publish = ["publish", self.course.id.to_deprecated_string()]
self.kwargs = {
"noop": False, "username": False,
"debug": False, "prefix": "", "exclude": None}
patcher0 = patch('pdfgen.views.logging')
self.log_mock = patcher0.start()
self.addCleanup(patcher0.stop)
patcher1 = patch('pdfgen.views.S3Connection')
self.s3conn_mock = patcher1.start()
self.addCleanup(patcher1.stop)
patcher2 = patch('pdfgen.views.Key')
self.s3key_mock = patcher2.start()
self.addCleanup(patcher2.stop)
self.s3key_mock().generate_url.return_value = "http://example.com"
self.pdf_path = settings.PDFGEN_BASE_PDF_DIR + "/" + self.kwargs['prefix'] + "-".join(
self.course.id.to_deprecated_string().split('/')) + ".pdf"
self.base_pdf = canvas.Canvas(self.pdf_path, pagesize=landscape(A4))
self.base_pdf.showPage()
self.base_pdf.save()