本文整理匯總了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()