本文整理汇总了Python中student.tests.factories.UserFactory.delete方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.delete方法的具体用法?Python UserFactory.delete怎么用?Python UserFactory.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student.tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PermissionTests
# 需要导入模块: from student.tests.factories import UserFactory [as 别名]
# 或者: from student.tests.factories.UserFactory import delete [as 别名]
class PermissionTests(TestCase):
"""
Tests for permissions defined in courseware.rules
"""
def setUp(self):
super(PermissionTests, self).setUp()
self.user = UserFactory()
self.course_id = CourseLocator('MITx', '000', 'Perm_course')
CourseModeFactory(mode_slug='verified', course_id=self.course_id)
CourseModeFactory(mode_slug='masters', course_id=self.course_id)
CourseModeFactory(mode_slug='professional', course_id=self.course_id)
CourseEnrollment.unenroll(self.user, self.course_id)
def tearDown(self):
super(PermissionTests, self).tearDown()
self.user.delete()
@ddt.data(
(None, False),
('audit', False),
('verified', True),
('masters', True),
('professional', True),
('no-id-professional', False),
)
@ddt.unpack
def test_proctoring_perm(self, mode, should_have_perm):
"""
Test that the user has the edx_proctoring.can_take_proctored_exam permission
"""
if mode is not None:
CourseEnrollment.enroll(self.user, self.course_id, mode=mode)
has_perm = self.user.has_perm('edx_proctoring.can_take_proctored_exam', {'course_id': unicode(self.course_id)})
assert has_perm == should_have_perm