本文整理汇总了Python中allianceauth.tests.auth_utils.AuthUtils.get_member_state方法的典型用法代码示例。如果您正苦于以下问题:Python AuthUtils.get_member_state方法的具体用法?Python AuthUtils.get_member_state怎么用?Python AuthUtils.get_member_state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类allianceauth.tests.auth_utils.AuthUtils
的用法示例。
在下文中一共展示了AuthUtils.get_member_state方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_autogroups_states_changed_add
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import get_member_state [as 别名]
def test_autogroups_states_changed_add(self, update_group_membership_for_state):
"""
Test update_group_membership_for_state is called when a state is added to
the AutogroupsConfig
"""
obj = AutogroupsConfig.objects.create(alliance_groups=True)
state = AuthUtils.get_member_state()
# Trigger
obj.states.add(state)
self.assertTrue(update_group_membership_for_state.called)
self.assertEqual(update_group_membership_for_state.call_count, 1)
args, kwargs = update_group_membership_for_state.call_args
self.assertEqual(args[0], state)
示例2: test_check_groups_on_character_update
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import get_member_state [as 别名]
def test_check_groups_on_character_update(self, update_groups_for_user):
"""
Test update_groups_for_user is called when main_character properties
are changed.
"""
# Trigger signal
self.member.profile.main_character.corporation_id = '2300'
self.member.profile.main_character.save()
self.assertTrue(update_groups_for_user.called)
self.assertEqual(update_groups_for_user.call_count, 1)
args, kwargs = update_groups_for_user.call_args
self.assertEqual(args[0], self.member)
member = User.objects.get(pk=self.member.pk)
self.assertEqual(member.profile.state, AuthUtils.get_member_state())
示例3: test_check_groups_on_profile_update_main_character
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import get_member_state [as 别名]
def test_check_groups_on_profile_update_main_character(self, update_groups_for_user):
char = EveCharacter.objects.create(
character_id='1266',
character_name='test character2',
corporation_id='2345',
corporation_name='test corp',
corporation_ticker='tickr',
alliance_id='3456',
alliance_name='alliance name',
)
# Trigger signal
self.member.profile.main_character = char
self.member.profile.save()
self.assertTrue(update_groups_for_user.called)
self.assertEqual(update_groups_for_user.call_count, 1)
args, kwargs = update_groups_for_user.call_args
self.assertEqual(args[0], self.member)
member = User.objects.get(pk=self.member.pk)
self.assertEqual(member.profile.state, AuthUtils.get_member_state())
示例4: setUp
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import get_member_state [as 别名]
def setUp(self):
disconnect_signals()
state = AuthUtils.get_member_state()
self.char = EveCharacter.objects.create(
character_id='1234',
character_name='test character',
corporation_id='2345',
corporation_name='test corp',
corporation_ticker='tickr',
alliance_id='3456',
alliance_name='alliance name',
)
self.alliance = EveAllianceInfo.objects.create(
alliance_id='3456',
alliance_name='alliance name',
alliance_ticker='TIKR',
executor_corp_id='2345',
)
self.corp = EveCorporationInfo.objects.create(
corporation_id='2345',
corporation_name='corp name',
corporation_ticker='TIKK',
member_count=10,
alliance=self.alliance,
)
state.member_alliances.add(self.alliance)
state.member_corporations.add(self.corp)
self.member = AuthUtils.create_member('test user')
self.member.profile.main_character = self.char
self.member.profile.save()
connect_signals()