當前位置: 首頁>>代碼示例>>Python>>正文


Python AuthUtils.create_user方法代碼示例

本文整理匯總了Python中allianceauth.tests.auth_utils.AuthUtils.create_user方法的典型用法代碼示例。如果您正苦於以下問題:Python AuthUtils.create_user方法的具體用法?Python AuthUtils.create_user怎麽用?Python AuthUtils.create_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在allianceauth.tests.auth_utils.AuthUtils的用法示例。


在下文中一共展示了AuthUtils.create_user方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUpTestData

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [as 別名]
 def setUpTestData(cls):
     cls.main_character = EveCharacter.objects.create(
         character_id=1,
         character_name='Main Character',
         corporation_id=1,
         corporation_name='Corp',
         corporation_ticker='CORP',
     )
     cls.alt_character = EveCharacter.objects.create(
         character_id=2,
         character_name='Alt Character',
         corporation_id=1,
         corporation_name='Corp',
         corporation_ticker='CORP',
     )
     cls.unclaimed_character = EveCharacter.objects.create(
         character_id=3,
         character_name='Unclaimed Character',
         corporation_id=1,
         corporation_name='Corp',
         corporation_ticker='CORP',
     )
     cls.user = AuthUtils.create_user('test_user', disconnect_signals=True)
     cls.old_user = AuthUtils.create_user('old_user', disconnect_signals=True)
     AuthUtils.disconnect_signals()
     CharacterOwnership.objects.create(user=cls.user, character=cls.main_character, owner_hash='1')
     CharacterOwnership.objects.create(user=cls.user, character=cls.alt_character, owner_hash='2')
     UserProfile.objects.update_or_create(user=cls.user, defaults={'main_character': cls.main_character})
     AuthUtils.connect_signals()
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:31,代碼來源:tests.py

示例2: setUp

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [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()
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:29,代碼來源:tests.py

示例3: setUp

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [as 別名]
    def setUp(self):
        self.member = AuthUtils.create_user('auth_member', disconnect_signals=True)

        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,
        )

        self.char = EveCharacter.objects.create(
            character_id='1234',
            character_name='test character',
            corporation_id='2345',
            corporation_name='test corp',
            corporation_ticker='TIKK',
            alliance_id='3456',
            alliance_name='alliance name',
            alliance_ticker='TIKR',
        )
        self.member.profile.main_character = self.char
        self.member.profile.save()
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:32,代碼來源:test_nameformatter.py

示例4: setUp

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [as 別名]
 def setUp(self):
     self.member = 'member_user'
     member = AuthUtils.create_member(self.member)
     Ips4User.objects.create(user=member, id='12345', username=self.member)
     self.none_user = 'none_user'
     none_user = AuthUtils.create_user(self.none_user)
     self.service = Ips4Service
     add_permissions()
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:10,代碼來源:tests.py

示例5: test_no_ownership

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [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())
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:10,代碼來源:tests.py

示例6: setUp

# 需要導入模塊: from allianceauth.tests.auth_utils import AuthUtils [as 別名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_user [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)
開發者ID:Kaezon,項目名稱:allianceauth,代碼行數:6,代碼來源:test_signals.py


注:本文中的allianceauth.tests.auth_utils.AuthUtils.create_user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。