本文整理汇总了Python中tests.FakeFasUser.cla_done方法的典型用法代码示例。如果您正苦于以下问题:Python FakeFasUser.cla_done方法的具体用法?Python FakeFasUser.cla_done怎么用?Python FakeFasUser.cla_done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.FakeFasUser
的用法示例。
在下文中一共展示了FakeFasUser.cla_done方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_admin_new_release
# 需要导入模块: from tests import FakeFasUser [as 别名]
# 或者: from tests.FakeFasUser import cla_done [as 别名]
def test_admin_new_release(self):
""" Test the admin_new_release function. """
user = None
with user_set(app.APP, user):
output = self.app.get('/admin/new', follow_redirects=True)
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<title>OpenID transaction in progress</title>'
in output.data)
user = FakeFasUser()
user.groups = []
user.cla_done = False
with user_set(app.APP, user):
output = self.app.get('/admin/new', follow_redirects=True)
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<li class="error">You are not an admin</li>' in output.data)
user = FakeFasUser()
user.groups = []
with user_set(app.APP, user):
output = self.app.get('/admin/new', follow_redirects=True)
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<li class="error">You are not an admin</li>' in output.data)
user = FakeFasUser()
user.groups.append('sysadmin-main')
with user_set(app.APP, user):
output = self.app.get('/admin/new')
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<title> New release' in output.data)
self.assertTrue(
"<label for=\"releasenum\">Release number <span "
"class='error'>*</span></label>" in output.data)
csrf_token = output.data.split(
'name="csrf_token" type="hidden" value="')[1].split('">')[0]
data = {
'csrf_token': csrf_token,
'releasenum': 20,
'support': 'RELEASE',
}
output = self.app.post(
'/admin/new', data=data, follow_redirects=True)
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<li class="message">Release "20" added</li>'
in output.data)
self.assertTrue("<a href='/release/20'>" in output.data)
self.assertTrue("<a href='/admin/20/edit'" in output.data)
示例2: test_is_admin
# 需要导入模块: from tests import FakeFasUser [as 别名]
# 或者: from tests.FakeFasUser import cla_done [as 别名]
def test_is_admin(self):
""" Test the is_admin method. """
self.assertFalse(app.is_admin(None))
user = FakeFasUser()
user.cla_done = False
self.assertFalse(app.is_admin(user))
user = FakeFasUser()
user.groups = []
self.assertFalse(app.is_admin(user))
user = FakeFasUser()
user.groups.append('sysadmin-main')
self.assertTrue(app.is_admin(user))