本文整理汇总了Python中allianceauth.tests.auth_utils.AuthUtils.add_main_character方法的典型用法代码示例。如果您正苦于以下问题:Python AuthUtils.add_main_character方法的具体用法?Python AuthUtils.add_main_character怎么用?Python AuthUtils.add_main_character使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类allianceauth.tests.auth_utils.AuthUtils
的用法示例。
在下文中一共展示了AuthUtils.add_main_character方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def setUp(self):
self.member = AuthUtils.create_member('auth_member')
AuthUtils.add_main_character(self.member, 'test character', '1234', '2345', 'test corp', 'testc')
self.member.email = '[email protected]'
self.member.save()
self.none_user = AuthUtils.create_user('none_user', disconnect_signals=True)
self.none_user2 = AuthUtils.create_user('none_user2', disconnect_signals=True)
self.none_user3 = AuthUtils.create_user('none_user3', disconnect_signals=True)
self.no_perm_user = AuthUtils.create_user('no_perm_user', disconnect_signals=True)
AuthUtils.disconnect_signals()
self.no_perm_group = Group.objects.create(name="No Permission Group")
self.test_group = Group.objects.create(name="Test group")
self.test_group.user_set.add(self.none_user)
self.test_group.user_set.add(self.none_user2)
self.test_group.user_set.add(self.none_user3)
self.permission = Permission.objects.get_by_natural_key(codename='audit_permissions',
app_label='permissions_tool',
model='permissionstool')
self.test_group.permissions.add(self.permission)
self.member.user_permissions.add(self.permission)
AuthUtils.connect_signals()
示例2: setUp
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def setUp(self):
self.member = AuthUtils.create_member('auth_member')
self.member.email = '[email protected]'
self.member.save()
AuthUtils.add_main_character(self.member, 'auth_member', '12345', corp_id='111', corp_name='Test Corporation',
corp_ticker='TESTR')
add_permissions()
示例3: test_no_ownership
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def test_no_ownership(self):
user = AuthUtils.create_user('v1 user', disconnect_signals=True)
AuthUtils.add_main_character(user, 'v1 character', '10', '20', 'test corp', 'test')
self.assertFalse(UserProfile.objects.filter(main_character__isnull=True).count())
call_command('checkmains', stdout=self.stdout)
self.assertEqual(UserProfile.objects.filter(main_character__isnull=True).count(), 1)
self.assertIn(user.username, self.stdout.getvalue())
示例4: setUpTestData
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def setUpTestData(cls):
cls.user = AuthUtils.create_user('test')
AuthUtils.add_main_character(cls.user, 'test character', '1', corp_id='2', corp_name='test_corp', corp_ticker='TEST', alliance_id='3', alliance_name='TEST')
cls.user.profile.refresh_from_db()
cls.token = Token.objects.create(user=cls.user, access_token='a', character_id='1', character_name='test character', character_owner_hash='a')
cls.corp = EveCorporationInfo.objects.create(corporation_id='2', corporation_name='test corp', corporation_ticker='TEST', member_count=1)
cls.corpstats = CorpStats.objects.create(token=cls.token, corp=cls.corp)
cls.member = CorpMember.objects.create(corpstats=cls.corpstats, character_id='2', character_name='other test character')
示例5: test_sync_nickname
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def test_sync_nickname(self, manager):
service = self.service()
member = User.objects.get(username=self.member)
AuthUtils.add_main_character(member, 'test user', '12345', corp_ticker='AAUTH')
service.sync_nickname(member)
self.assertTrue(manager.update_nickname.called)
args, kwargs = manager.update_nickname.call_args
self.assertEqual(args[0], member.discord.uid)
self.assertEqual(args[1], 'test user')
示例6: setUp
# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import add_main_character [as 别名]
def setUp(self):
self.member = AuthUtils.create_user('auth_member', disconnect_signals=True)
AuthUtils.add_main_character(self.member, 'Test', '1', '2', 'Test Corp', 'TEST')
self.none_user = AuthUtils.create_user('none_user', disconnect_signals=True)