本文整理汇总了Python中auth_systems.AUTH_SYSTEMS.iteritems方法的典型用法代码示例。如果您正苦于以下问题:Python AUTH_SYSTEMS.iteritems方法的具体用法?Python AUTH_SYSTEMS.iteritems怎么用?Python AUTH_SYSTEMS.iteritems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth_systems.AUTH_SYSTEMS
的用法示例。
在下文中一共展示了AUTH_SYSTEMS.iteritems方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_eq
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_eq(self):
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
u = models.User.update_or_create(
user_type=auth_system, user_id='foobar_eq', info={'name': 'Foo Bar Status Update'})
u2 = models.User.update_or_create(
user_type=auth_system, user_id='foobar_eq', info={'name': 'Foo Bar Status Update'})
self.assertEquals(u, u2)
示例2: test_can_create_election
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_can_create_election(self):
"""
check that auth systems have the can_create_election call and that it's true for the common ones
"""
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
assert(hasattr(auth_system_module, 'can_create_election'))
if auth_system != 'clever':
assert(auth_system_module.can_create_election('foobar', {}))
示例3: test_eligibility
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_eligibility(self):
"""
test that users are reported as eligible for something
FIXME: also test constraints on eligibility
"""
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
u = models.User.update_or_create(user_type = auth_system, user_id = 'foobar_status_update', info={'name':'Foo Bar Status Update'})
self.assertTrue(u.is_eligible_for({'auth_system': auth_system}))
示例4: test_status_update
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_status_update(self):
"""
check that a user set up with status update ability reports it as such,
and otherwise does not report it
"""
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
u = models.User.update_or_create(user_type = auth_system, user_id = 'foobar_status_update', info={'name':'Foo Bar Status Update'})
if hasattr(auth_system_module, 'send_message'):
self.assertNotEquals(u.update_status_template, None)
else:
self.assertEquals(u.update_status_template, None)
示例5: test_unique_users
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_unique_users(self):
"""
there should not be two users with the same user_type and user_id
"""
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
models.User.objects.create(user_type = auth_system, user_id = 'foobar', info={'name':'Foo Bar'})
def double_insert():
models.User.objects.create(user_type = auth_system, user_id = 'foobar', info={'name': 'Foo2 Bar'})
self.assertRaises(IntegrityError, double_insert)
transaction.rollback()
示例6: test_create_or_update
# 需要导入模块: from auth_systems import AUTH_SYSTEMS [as 别名]
# 或者: from auth_systems.AUTH_SYSTEMS import iteritems [as 别名]
def test_create_or_update(self):
"""
shouldn't create two users, and should reset the password
"""
for auth_system, auth_system_module in AUTH_SYSTEMS.iteritems():
u = models.User.update_or_create(user_type = auth_system, user_id = 'foobar_cou', info={'name':'Foo Bar'})
def double_update_or_create():
new_name = 'Foo2 Bar'
u2 = models.User.update_or_create(user_type = auth_system, user_id = 'foobar_cou', info={'name': new_name})
self.assertEquals(u.id, u2.id)
self.assertEquals(u2.info['name'], new_name)