当前位置: 首页>>代码示例>>Python>>正文


Python AuthUtils.create_member方法代码示例

本文整理汇总了Python中allianceauth.tests.auth_utils.AuthUtils.create_member方法的典型用法代码示例。如果您正苦于以下问题:Python AuthUtils.create_member方法的具体用法?Python AuthUtils.create_member怎么用?Python AuthUtils.create_member使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在allianceauth.tests.auth_utils.AuthUtils的用法示例。


在下文中一共展示了AuthUtils.create_member方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_member [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()
开发者ID:Kaezon,项目名称:allianceauth,代码行数:9,代码来源:tests.py

示例2: setUp

# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_member [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: test_update_groups_for_state

# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_member [as 别名]
    def test_update_groups_for_state(self):
        member = AuthUtils.create_member('test member')
        obj = AutogroupsConfig.objects.create()
        obj.states.add(member.profile.state)

        with patch('.models.AutogroupsConfig.update_group_membership_for_user') as update_group_membership_for_user:
            AutogroupsConfig.objects.update_groups_for_state(member.profile.state)

            self.assertTrue(update_group_membership_for_user.called)
            self.assertEqual(update_group_membership_for_user.call_count, 1)
            args, kwargs = update_group_membership_for_user.call_args
            self.assertEqual(args[0], member)
开发者ID:Kaezon,项目名称:allianceauth,代码行数:14,代码来源:test_managers.py

示例4: test_update_groups_no_config

# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_member [as 别名]
    def test_update_groups_no_config(self, remove_corp, remove_alliance, update_groups):
        member = AuthUtils.create_member('test member')
        obj = AutogroupsConfig.objects.create()

        # Corp and alliance groups should be removed from users if their state has no config
        AutogroupsConfig.objects.update_groups_for_user(member)

        self.assertFalse(update_groups.called)
        self.assertTrue(remove_alliance.called)
        self.assertTrue(remove_corp.called)

        # The normal group assignment should occur if there state has a config
        obj.states.add(member.profile.state)
        AutogroupsConfig.objects.update_groups_for_user(member)

        self.assertTrue(update_groups.called)
开发者ID:Kaezon,项目名称:allianceauth,代码行数:18,代码来源:test_managers.py

示例5: setUp

# 需要导入模块: from allianceauth.tests.auth_utils import AuthUtils [as 别名]
# 或者: from allianceauth.tests.auth_utils.AuthUtils import create_member [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()
开发者ID:Kaezon,项目名称:allianceauth,代码行数:39,代码来源:test_signals.py


注:本文中的allianceauth.tests.auth_utils.AuthUtils.create_member方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。