本文整理汇总了Python中the_tale.common.utils.permissions.sync_group函数的典型用法代码示例。如果您正苦于以下问题:Python sync_group函数的具体用法?Python sync_group怎么用?Python sync_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sync_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(BaseRequestTests, self).setUp()
create_test_map()
result, account_id, bundle_id = register_user('test_user_1', '[email protected]', '111111')
self.account_1 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account_2 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('test_user_3', '[email protected]', '111111')
self.account_3 = AccountPrototype.get_by_id(account_id)
group_edit_item = sync_group('edit item', ['collections.edit_item'])
group_moderate_item = sync_group('moderate item', ['collections.moderate_item'])
group_edit = sync_group('edit kit', ['collections.edit_kit'])
group_moderate = sync_group('moderate kit', ['collections.moderate_kit'])
group_edit_item.user_set.add(self.account_2._model)
group_moderate_item.user_set.add(self.account_3._model)
group_edit.user_set.add(self.account_2._model)
group_moderate.user_set.add(self.account_3._model)
self.collection_1 = CollectionPrototype.create(caption=u'collection_1', description=u'description_1')
self.collection_2 = CollectionPrototype.create(caption=u'collection_2', description=u'description_2')
self.kit_1 = KitPrototype.create(collection=self.collection_1, caption=u'kit_1', description=u'description_1', approved=True)
self.kit_2 = KitPrototype.create(collection=self.collection_1, caption=u'kit_2', description=u'description_2')
self.item_1_1 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_1', text=u'text_1_1')
self.item_1_2 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_2', text=u'text_1_2', approved=True)
示例2: setUp
def setUp(self):
super(EnableRequestsTests, self).setUp()
self.companion_1 = logic.create_companion_record(utg_name=names.generator.get_test_name(u'c-1'),
description='companion-description-1',
type=game_relations.BEING_TYPE.random(),
max_health=100,
dedication=relations.DEDICATION.random(),
archetype=game_relations.ARCHETYPE.random(),
abilities=helpers.FAKE_ABILITIES_CONTAINER_1,
mode=relations.MODE.random(),
communication_verbal=game_relations.COMMUNICATION_VERBAL.random(),
communication_gestures=game_relations.COMMUNICATION_GESTURES.random(),
communication_telepathic=game_relations.COMMUNICATION_TELEPATHIC.random(),
intellect_level=game_relations.INTELLECT_LEVEL.random(),
state=relations.STATE.DISABLED)
self.requested_url = url('game:companions:enable', self.companion_1.id)
self.account_1 = self.accounts_factory.create_account()
self.account_2 = self.accounts_factory.create_account()
self.account_3 = self.accounts_factory.create_account()
group_edit = sync_group('edit companions', ['companions.create_companionrecord'])
group_edit.user_set.add(self.account_2._model)
group_edit = sync_group('moderate companions', ['companions.moderate_companionrecord'])
group_edit.user_set.add(self.account_3._model)
示例3: setUp
def setUp(self):
super(InfoRequestsTests, self).setUp()
self.companion_1 = logic.create_companion_record(utg_name=names.generator.get_test_name(u'c-1'),
description='companion-description-1',
type=relations.TYPE.random(),
max_health=100,
dedication=relations.DEDICATION.random(),
archetype=game_relations.ARCHETYPE.random(),
mode=relations.MODE.random(),
abilities=helpers.FAKE_ABILITIES_CONTAINER_1,
state=relations.STATE.ENABLED)
self.companion_2 = logic.create_companion_record(utg_name=names.generator.get_test_name(u'c-2'),
description='companion-description-2',
type=relations.TYPE.random(),
max_health=100,
dedication=relations.DEDICATION.random(),
archetype=game_relations.ARCHETYPE.random(),
mode=relations.MODE.random(),
abilities=helpers.FAKE_ABILITIES_CONTAINER_2,
state=relations.STATE.DISABLED)
self.requested_url_1 = url('game:companions:info', self.companion_1.id)
self.requested_url_2 = url('game:companions:info', self.companion_2.id)
self.account_1 = self.accounts_factory.create_account()
self.account_2 = self.accounts_factory.create_account()
self.account_3 = self.accounts_factory.create_account()
group_edit = sync_group('edit companions', ['companions.create_companionrecord'])
group_edit.user_set.add(self.account_2._model)
group_moderate = sync_group('moderate companions', ['companions.moderate_companionrecord'])
group_moderate.user_set.add(self.account_3._model)
示例4: setUp
def setUp(self):
super(TestModeration, self).setUp()
create_test_map()
register_user('main_user', '[email protected]', '111111')
register_user('moderator', '[email protected]', '111111')
register_user('second_user', '[email protected]', '111111')
self.main_account = AccountPrototype.get_by_nick('main_user')
self.moderator = AccountPrototype.get_by_nick('moderator')
self.second_account = AccountPrototype.get_by_nick('second_user')
group = sync_group(forum_settings.MODERATOR_GROUP_NAME, ['forum.moderate_post', 'forum.moderate_thread'])
group.user_set.add(self.moderator._model)
self.client = client.Client()
self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0)
self.subcategory = SubCategoryPrototype.create(category=self.category, caption='subcat-caption', order=0)
self.subcategory2 = SubCategoryPrototype.create(category=self.category, caption='subcat2-caption', order=1, closed=True)
self.thread = ThreadPrototype.create(self.subcategory, 'thread-caption', self.main_account, 'thread-text')
self.post = PostPrototype.create(self.thread, self.main_account, 'post-text')
self.post2 = PostPrototype.create(self.thread, self.main_account, 'post2-text')
self.post5 = PostPrototype.create(self.thread, self.main_account, 'post5-text', technical=True)
self.thread2 = ThreadPrototype.create(self.subcategory, 'thread2-caption', self.main_account, 'thread2-text')
self.post3 = PostPrototype.create(self.thread2, self.main_account, 'post3-text')
self.post4 = PostPrototype.create(self.thread2, self.second_account, 'post4-text')
self.thread3 = ThreadPrototype.create(self.subcategory, 'thread3-caption', self.second_account, 'thread3-text')
示例5: setUp
def setUp(self):
super(_BaseRequestTests, self).setUp()
create_test_map()
result, account_id, bundle_id = register_user('test_user_1', '[email protected]', '111111')
self.account_1 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account_2 = AccountPrototype.get_by_id(account_id)
group_edit = sync_group('edit achievement', ['achievements.edit_achievement'])
group_edit.user_set.add(self.account_2._model)
self.achievement_1 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=0, points=10,
caption=u'achievement_1', description=u'description_1', approved=True)
self.achievement_2 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=2, points=10,
caption=u'achievement_2', description=u'description_2', approved=False)
self.achievement_3 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.TIME, type=ACHIEVEMENT_TYPE.TIME, barrier=3, points=10,
caption=u'achievement_3', description=u'description_3', approved=True)
self.collection_1 = CollectionPrototype.create(caption=u'collection_1', description=u'description_1', approved=True)
self.kit_1 = KitPrototype.create(collection=self.collection_1, caption=u'kit_1', description=u'description_1', approved=True)
self.item_1_1 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_1', text=u'text_1_1', approved=True)
self.item_1_2 = ItemPrototype.create(kit=self.kit_1, caption=u'item_1_2', text=u'text_1_2', approved=True)
self.account_achievements_1 = AccountAchievementsPrototype.get_by_account_id(self.account_1.id)
self.account_achievements_1.achievements.add_achievement(self.achievement_1)
self.account_achievements_1.save()
示例6: setUp
def setUp(self):
super(BanRequestsTests, self).setUp()
group = sync_group('accounts moderators group', ['accounts.moderate_account'])
group.user_set.add(self.account_3._model)
self.request_login('[email protected]')
示例7: setUp
def setUp(self):
super(AchievementsManagerTests, self).setUp()
create_test_map()
result, account_id, bundle_id = register_user('test_user_1', '[email protected]', '111111')
self.account_1 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account_2 = AccountPrototype.get_by_id(account_id)
group_edit = sync_group('edit achievement', ['achievements.edit_achievement'])
group_edit.user_set.add(self.account_2._model)
self.achievement_1 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=0, points=10,
caption=u'achievement_1', description=u'description_1', approved=True)
self.achievement_2 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.MONEY, type=ACHIEVEMENT_TYPE.MONEY, barrier=5, points=10,
caption=u'achievement_2', description=u'description_2', approved=False)
self.achievement_3 = AchievementPrototype.create(group=ACHIEVEMENT_GROUP.TIME, type=ACHIEVEMENT_TYPE.DEATHS, barrier=4, points=10,
caption=u'achievement_3', description=u'description_3', approved=True)
self.account_achievements_1 = AccountAchievementsPrototype.get_by_account_id(self.account_1.id)
self.account_achievements_1.achievements.add_achievement(self.achievement_1)
self.account_achievements_1.save()
self.worker = environment.workers.achievements_manager
self.worker.initialize()
示例8: test_moderator
def test_moderator(self):
self.request_logout()
self.request_login('[email protected]')
group = sync_group('folclor moderation group', ['blogs.moderate_post'])
group.user_set.add(self.account_2._model)
self.check_html_ok(self.request_html(reverse('blogs:posts:edit', args=[self.post.id])), texts=(self.post.caption,
self.post.text))
示例9: test_show_for_moderator
def test_show_for_moderator(self):
self.request_login('[email protected]')
group = sync_group('accounts moderators group', ['accounts.moderate_account'])
group.user_set.add(self.account_3._model)
texts = [('pgf-account-admin-link', 1)]
self.check_html_ok(self.request_html(reverse('accounts:show', args=[self.account_1.id])), texts=texts)
示例10: test_moderator
def test_moderator(self):
self.request_logout()
self.request_login(self.account_2.email)
group = sync_group("folclor moderation group", ["blogs.moderate_post"])
group.user_set.add(self.account_2._model)
self.check_html_ok(
self.request_html(reverse("blogs:posts:edit", args=[self.post.id])),
texts=(self.post.caption, self.post.text),
)
示例11: test_moderation_tab
def test_moderation_tab(self):
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
account_2 = AccountPrototype.get_by_id(account_id)
self.request_login('[email protected]')
group = sync_group('accounts moderators group', ['accounts.moderate_account'])
group.user_set.add(account_2._model)
self.check_html_ok(self.request_html(url('game:heroes:show', self.hero.id)), texts=['pgf-moderation-container'])
示例12: setUp
def setUp(self):
super(BaseTestRequests, self).setUp()
artifacts_storage.sync(force=True)
self.place_1, self.place_2, self.place_3 = create_test_map()
self.account_1 = self.accounts_factory.create_account()
self.account_2 = self.accounts_factory.create_account()
self.account_3 = self.accounts_factory.create_account()
self.client = client.Client()
self.request_login(self.account_1.email)
group_create = sync_group("create artifact", ["artifacts.create_artifactrecord"])
group_add = sync_group("add create_artifact", ["artifacts.moderate_artifactrecord"])
group_create.user_set.add(self.account_2._model)
group_add.user_set.add(self.account_3._model)
示例13: setUp
def setUp(self):
super(ForceSaveRequestsTests, self).setUp()
result, account_id, bundle_id = register_user('test_user_2', '[email protected]', '111111')
self.account_2 = AccountPrototype.get_by_id(account_id)
group = sync_group('accounts moderators group', ['accounts.moderate_account'])
group.user_set.add(self.account_2._model)
self.request_login('[email protected]')
示例14: setUp
def setUp(self):
super(TestModerateRequests, self).setUp()
self.request_login(self.account_1.email)
self.client.post(reverse("blogs:posts:create"), {"caption": "post-caption", "text": "post-text-" + "1" * 1000})
self.post = prototypes.PostPrototype(models.Post.objects.all()[0])
self.request_logout()
self.request_login(self.account_2.email)
group = sync_group("folclor moderation group", ["blogs.moderate_post"])
group.user_set.add(self.account_2._model)
示例15: setUp
def setUp(self):
super(BaseRequestsTests, self).setUp()
create_test_map()
result, account_id, bundle_id = register_user('test_user1', '[email protected]', '111111')
self.account_1 = AccountPrototype.get_by_id(account_id)
result, account_id, bundle_id = register_user('moderator', '[email protected]', '111111')
self.moderator = AccountPrototype.get_by_id(account_id)
group = sync_group(linguistics_settings.MODERATOR_GROUP_NAME, ['linguistics.moderate_word'])
group.user_set.add(self.moderator._model)