def __init__(self, accounts_factory): self.account_1 = accounts_factory.create_account() self.account_2 = accounts_factory.create_account() # cat1 # |-subcat1 # | |-thread1 # | | |-post1 # | |-thread2 # |-subcat2 # cat2 # | subcat3 # | |- thread3 # cat3 self.cat_1 = CategoryPrototype.create(caption='cat1-caption', slug='cat1-slug', order=0) # to test, that subcat.id not correlate with order self.subcat_2 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat2-caption', order=1, closed=True) self.subcat_1 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat1-caption', order=0) self.cat_2 = CategoryPrototype.create(caption='cat2-caption', slug='cat2-slug', order=0) self.subcat_3 = SubCategoryPrototype.create(category=self.cat_2, caption='subcat3-caption', order=0) self.cat_3 = CategoryPrototype.create(caption='cat3-caption', slug='cat3-slug', order=0) self.thread_1 = ThreadPrototype.create(self.subcat_1, 'thread1-caption', self.account_1, 'thread1-text') self.thread_2 = ThreadPrototype.create(self.subcat_1, 'thread2-caption', self.account_1, 'thread2-text') self.thread_3 = ThreadPrototype.create(self.subcat_3, 'thread3-caption', self.account_1, 'thread3-text') self.post_1 = PostPrototype.create(self.thread_1, self.account_1, 'post1-text') # create test clan and clean it's forum artifacts self.clan_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_1 = ClanPrototype.create(self.account_1, abbr='abbr1', name='name1', motto='motto', description='description')
def __init__(self): register_user('forum_user', '*****@*****.**', '111111') register_user('forum_user_2', '*****@*****.**', '111111') self.account_1 = AccountPrototype.get_by_nick('forum_user') self.account_2 = AccountPrototype.get_by_nick('forum_user_2') # cat1 # |-subcat1 # | |-thread1 # | | |-post1 # | |-thread2 # |-subcat2 # cat2 # | subcat3 # | |- thread3 # cat3 self.cat_1 = CategoryPrototype.create(caption='cat1-caption', slug='cat1-slug', order=0) # to test, that subcat.id not correlate with order self.subcat_2 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat2-caption', order=1, closed=True) self.subcat_1 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat1-caption', order=0) self.cat_2 = CategoryPrototype.create(caption='cat2-caption', slug='cat2-slug', order=0) self.subcat_3 = SubCategoryPrototype.create(category=self.cat_2, caption='subcat3-caption', order=0) self.cat_3 = CategoryPrototype.create(caption='cat3-caption', slug='cat3-slug', order=0) self.thread_1 = ThreadPrototype.create(self.subcat_1, 'thread1-caption', self.account_1, 'thread1-text') self.thread_2 = ThreadPrototype.create(self.subcat_1, 'thread2-caption', self.account_1, 'thread2-text') self.thread_3 = ThreadPrototype.create(self.subcat_3, 'thread3-caption', self.account_1, 'thread3-text') self.post_1 = PostPrototype.create(self.thread_1, self.account_1, 'post1-text') # create test clan and clean it's forum artifacts self.clan_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_1 = ClanPrototype.create(self.account_1, abbr=u'abbr1', name=u'name1', motto=u'motto', description=u'description')
def __init__(self, accounts_factory): self.account_1 = accounts_factory.create_account() self.account_2 = accounts_factory.create_account() # cat1 # |-subcat1 # | |-thread1 # | | |-post1 # | |-thread2 # |-subcat2 # cat2 # | subcat3 # | |- thread3 # cat3 self.cat_1 = CategoryPrototype.create(caption='cat1-caption', slug='cat1-slug', order=0) # to test, that subcat.id not correlate with order self.subcat_2 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat2-caption', order=1, closed=True) self.subcat_1 = SubCategoryPrototype.create(category=self.cat_1, caption='subcat1-caption', order=0) self.cat_2 = CategoryPrototype.create(caption='cat2-caption', slug='cat2-slug', order=0) self.subcat_3 = SubCategoryPrototype.create(category=self.cat_2, caption='subcat3-caption', order=0) self.cat_3 = CategoryPrototype.create(caption='cat3-caption', slug='cat3-slug', order=0) self.thread_1 = ThreadPrototype.create(self.subcat_1, 'thread1-caption', self.account_1, 'thread1-text') self.thread_2 = ThreadPrototype.create(self.subcat_1, 'thread2-caption', self.account_1, 'thread2-text') self.thread_3 = ThreadPrototype.create(self.subcat_3, 'thread3-caption', self.account_1, 'thread3-text') self.post_1 = PostPrototype.create(self.thread_1, self.account_1, 'post1-text') # create test clan and clean it's forum artifacts self.clan_category = CategoryPrototype.create( caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_1 = ClanPrototype.create(self.account_1, abbr='abbr1', name='name1', motto='motto', description='description')
def setUp(self): super(ClanInfoTests, self).setUp() create_test_map() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.account = self.accounts_factory.create_account() self.clan_info = ClanInfo(account=self.account)
def setUp(self): super(BaseTestRequests, self).setUp() create_test_map() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.account = self.accounts_factory.create_account() pm_tt_api.debug_clear_service()
def setUp(self): super(ClanInfoTests, self).setUp() create_test_map() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) result, account_id, bundle_id = register_user('test_user_1', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_id(account_id) self.clan_info = ClanInfo(account=self.account)
def setUp(self): super(FriendshipRequestsTests, self).setUp() 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() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create(self.account_2, abbr='abbr2', name='name2', motto='motto', description='description') self.clan_3 = ClanPrototype.create(self.account_3, abbr='abbr3', name='name3', motto='motto', description='description') self.request_login(self.account_1.email)
def setUp(self): super(AccountRequestsTests, self).setUp() self.place1, self.place2, self.place3 = 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.account_4 = self.accounts_factory.create_account(is_fast=True) self.account_bot = self.accounts_factory.create_account(is_bot=True) CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create(self.account_2, abbr='abbr2', name='name2', motto='motto', description='description') self.clan_3 = ClanPrototype.create(self.account_3, abbr='abbr3', name='name3', motto='motto', description='description')
def setUp(self): super(BaseTestRequests, self).setUp() self.place1, self.place2, self.place3 = create_test_map() self.account_1 = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account() self.client = client.Client() helpers.prepair_forum() CategoryPrototype.create(caption="category-1", slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create( self.account_2, abbr="abbr2", name="name2", motto="motto", description="description" )
def setUp(self): super(TestModeration, self).setUp() create_test_map() register_user('main_user', '*****@*****.**', '111111') register_user('moderator', '*****@*****.**', '111111') register_user('second_user', '*****@*****.**', '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')
def index(self): categories = list( CategoryPrototype(category_model) for category_model in Category.objects.all().order_by( 'order', 'id')) subcategories = SubCategoryPrototype.subcategories_visible_to_account( account=self.account if self.account.is_authenticated() else None) forum_structure = [] read_states = { subcategory.id: ReadState(account=self.account) for subcategory in subcategories } for category in categories: children = [] for subcategory in subcategories: if subcategory.category_id == category.id: children.append(subcategory) forum_structure.append({ 'category': category, 'subcategories': children }) return self.template('forum/index.html', { 'forum_structure': forum_structure, 'read_states': read_states })
def setUp(self): super(CalculateMightTests, self).setUp() self.place_1, self.place_2, self.place_3 = create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account( referral_of_id=self.account.id) self.forum_category = CategoryPrototype.create('category', 'category-slug', 0) self.bills_subcategory = SubCategoryPrototype.create( self.forum_category, 'subcategory', order=0, uid=bills_settings.FORUM_CATEGORY_UID) self.blogs_subcategory = SubCategoryPrototype.create( self.forum_category, blogs_conf.settings.FORUM_CATEGORY_UID + '-caption', order=1, uid=blogs_conf.settings.FORUM_CATEGORY_UID) self.restricted_subcategory = SubCategoryPrototype.create( self.forum_category, 'restricted-caption', order=2, restricted=True, uid='restricted-sub')
def setUp(self): super(SubscriptionPrototypeTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account() self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory_1 = SubCategoryPrototype.create( category=self.category, caption='subcat-1-caption', order=0) self.subcategory_2 = SubCategoryPrototype.create( category=self.category, caption='subcat-2-caption', order=1) self.thread_1_1 = ThreadPrototype.create(self.subcategory_1, 'thread-1-1-caption', self.account, 'thread-1-1-text') self.thread_1_2 = ThreadPrototype.create(self.subcategory_1, 'thread-1-2-caption', self.account, 'thread-1-2-text') self.thread_1_3 = ThreadPrototype.create(self.subcategory_1, 'thread-1-3-caption', self.account_2, 'thread-1-3-text') self.thread_2_1 = ThreadPrototype.create(self.subcategory_2, 'thread-2-1-caption', self.account, 'thread-2-1-text') self.thread_2_2 = ThreadPrototype.create(self.subcategory_2, 'thread-2-2-caption', self.account, 'thread-2-2-text')
def create(cls, owner, abbr, name, motto, description): forum_category = CategoryPrototype.get_by_slug(clans_settings.FORUM_CATEGORY_SLUG) subcategory_order = SubCategoryPrototype._db_filter(category=forum_category.id).aggregate(models.Max('order'))['order__max'] if subcategory_order is None: subcategory_order = 0 else: subcategory_order += 1 forum_subcategory = SubCategoryPrototype.create(category=forum_category, caption=cls.get_forum_subcategory_caption(name), order=subcategory_order, restricted=True) clan_model = cls._model_class.objects.create(name=name, abbr=abbr, motto=motto, description=description, members_number=1, forum_subcategory=forum_subcategory._model) clan = cls(clan_model) MembershipPrototype.create(owner, clan, role=MEMBER_ROLE.LEADER) owner.set_clan_id(clan.id) return clan
def setUp(self): super(ReadStateTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account() category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create( category=category, caption='subcat-caption', order=0) self.subcategory_2 = SubCategoryPrototype.create( category=category, caption='subcat-2-caption', order=0) self.thread = ThreadPrototype.create(self.subcategory, 'thread1-caption', self.account_2, 'thread-text') self.thread_2 = ThreadPrototype.create(self.subcategory, 'thread2-caption', self.account_2, 'thread-2-text') self.thread_3 = ThreadPrototype.create(self.subcategory_2, 'thread2-caption', self.account, 'thread-2-text')
def test_subcategories_visible_to_account_with_permissions(self): register_user('test_user', '*****@*****.**', '111111') register_user('granted_user', '*****@*****.**', '111111') register_user('wrong_user', '*****@*****.**', '111111') granted_account = AccountPrototype.get_by_nick('granted_user') wrong_account = AccountPrototype.get_by_nick('wrong_user') category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) subcategory_1 = SubCategoryPrototype.create(category=category, caption='subcat-1-caption', order=2) SubCategoryPrototype.create(category=category, caption='subcat-2-caption', order=1, restricted=True) restricted_subcategory = SubCategoryPrototype.create(category=category, caption='subcat-restricted-caption', order=0, restricted=True) PermissionPrototype.create(granted_account, restricted_subcategory) self.assertEqual([s.id for s in SubCategoryPrototype.subcategories_visible_to_account(account=None)], [subcategory_1.id]) self.assertEqual([s.id for s in SubCategoryPrototype.subcategories_visible_to_account(account=granted_account)], [restricted_subcategory.id, subcategory_1.id]) self.assertEqual([s.id for s in SubCategoryPrototype.subcategories_visible_to_account(account=wrong_account)], [subcategory_1.id])
def setUp(self): super(MembershipRequestPrototypeTests, self).setUp() self.forum_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) create_test_map() result, account_id, bundle_id = register_user('test_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_id(account_id)
def setUp(self): super(MembershipRequestPrototypeTests, self).setUp() self.forum_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) create_test_map() self.account = self.accounts_factory.create_account()
def setUp(self): super(BaseTestRequests, self).setUp() self.place1, self.place2, self.place3 = create_test_map() result, account_id, bundle_id = register_user('test_user_1', '*****@*****.**', '111111') self.account_1 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111') self.account_2 = AccountPrototype.get_by_id(account_id) self.client = client.Client() helpers.prepair_forum() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create(self.account_2, abbr=u'abbr2', name=u'name2', motto=u'motto', description=u'description')
def setUp(self): super(ClanPrototypeTransactionTests, self).setUp() create_test_map() self.forum_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.account = self.accounts_factory.create_account() self.clan = ClanPrototype.create(self.account, abbr='abbr', name='clan-name', motto='clan-motto', description='clan-description')
def setUp(self): super(PermissionPrototypeTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create(category=self.category, caption='subcat-caption', order=0)
def test_has_clan(self): from the_tale.forum.prototypes import CategoryPrototype CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) clan = ClanPrototype.create(self.account, abbr='abbr', name='name', motto='motto', description='description') info = logic.get_account_info(self.account, self.hero) self.assertEqual(info['clan'], { 'id': clan.id, 'abbr': clan.abbr, 'name': clan.name })
def setUp(self): super(ClanPrototypeTransactionTests, self).setUp() create_test_map() self.forum_category = CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) result, account_id, bundle_id = register_user('test_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_id(account_id) self.clan = ClanPrototype.create(self.account, abbr=u'abbr', name=u'clan-name', motto='clan-motto', description=u'clan-description')
def setUp(self): super(FriendshipRequestsTests, self).setUp() create_test_map() result, account_id, bundle_id = register_user('test_user_1', '*****@*****.**', '111111') self.account_1 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111') self.account_2 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = register_user('test_user_3', '*****@*****.**', '111111') self.account_3 = AccountPrototype.get_by_id(account_id) CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create(self.account_2, abbr=u'abbr2', name=u'name2', motto=u'motto', description=u'description') self.clan_3 = ClanPrototype.create(self.account_3, abbr=u'abbr3', name=u'name3', motto=u'motto', description=u'description') self.request_login('*****@*****.**')
def setUp(self): super(CreateClanTests, self).setUp() CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) 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.storage = LogicStorage() self.storage.load_account_data(self.account_1) self.hero = self.storage.accounts_to_heroes[self.account_1.id] environment.deinitialize() environment.initialize()
def setUp(self): super(PermissionPrototypeTests, self).setUp() create_test_map() register_user('user_1', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('user_1') self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create(category=self.category, caption='subcat-caption', order=0)
def setUp(self): super(ThreadPrototypeTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() 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.thread = ThreadPrototype.create(self.subcategory, 'thread-caption', self.account, 'thread-text')
def setUp(self): super(ThreadPrototypeTests, self).setUp() create_test_map() register_user('test_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('test_user') 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.thread = ThreadPrototype.create(self.subcategory, 'thread-caption', self.account, 'thread-text')
def setUp(self): super(NewForumThreadTests, self).setUp() create_test_map() self.account_1 = self.accounts_factory.create_account() 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.thread = ThreadPrototype.create(self.subcategory, 'thread_1-caption', self.account_1, 'thread-text') self.message = MessagePrototype.get_priority_message()
def setUp(self): super(TestModeration, self).setUp() create_test_map() register_user('main_user', '*****@*****.**', '111111') register_user('moderator', '*****@*****.**', '111111') register_user('second_user', '*****@*****.**', '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')
def setUp(self): super(NewForumThreadTests, self).setUp() create_test_map() register_user('user_1', '*****@*****.**', '111111') self.account_1 = AccountPrototype.get_by_nick('user_1') 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.thread = ThreadPrototype.create(self.subcategory, 'thread_1-caption', self.account_1, 'thread-text') self.message = MessagePrototype.get_priority_message()
def setUp(self): super(CalculateMightTests, self).setUp() self.place_1, self.place_2, self.place_3 = create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account(referral_of_id=self.account.id) self.forum_category = CategoryPrototype.create('category', 'category-slug', 0) self.bills_subcategory = SubCategoryPrototype.create(self.forum_category, 'subcategory', order=0, uid=bills_settings.FORUM_CATEGORY_UID) self.blogs_subcategory = SubCategoryPrototype.create(self.forum_category, blogs_conf.settings.FORUM_CATEGORY_UID + '-caption', order=1, uid=blogs_conf.settings.FORUM_CATEGORY_UID) self.restricted_subcategory = SubCategoryPrototype.create(self.forum_category, 'restricted-caption', order=2, restricted=True, uid='restricted-sub')
def setUp(self): super(PermissionPrototypeTests, self).setUp() create_test_map() register_user('user_1', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('user_1') self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create( category=self.category, caption='subcat-caption', order=0)
def setUp(self): super(CalculateMightTests, self).setUp() self.place_1, self.place_2, self.place_3 = create_test_map() result, account_id, bundle_id = register_user('test_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111', referral_of_id=self.account.id) self.account_2 = AccountPrototype.get_by_id(account_id) self.forum_category = CategoryPrototype.create('category', 'category-slug', 0) self.bills_subcategory = SubCategoryPrototype.create(self.forum_category, 'subcategory', order=0, uid=bills_settings.FORUM_CATEGORY_UID) self.blogs_subcategory = SubCategoryPrototype.create(self.forum_category, blogs_conf.settings.FORUM_CATEGORY_UID + '-caption', order=1, uid=blogs_conf.settings.FORUM_CATEGORY_UID)
def setUp(self): super(ThreadReadInfoPrototypeTests, self).setUp() create_test_map() register_user('user_1', '*****@*****.**', '111111') register_user('user_2', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('user_1') self.account_2 = AccountPrototype.get_by_nick('user_2') category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) subcategory = SubCategoryPrototype.create(category=category, caption='subcat-caption', order=0) self.thread = ThreadPrototype.create(subcategory, 'thread1-caption', self.account, 'thread-text')
def setUp(self): super(AccountRequestsTests, self).setUp() self.place1, self.place2, self.place3 = create_test_map() result, account_id, bundle_id = logic.register_user('test_user1', '*****@*****.**', '111111') self.account_1 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = logic.register_user('test_user2', '*****@*****.**', '111111') self.account_2 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = logic.register_user('test_user3', '*****@*****.**', '111111') self.account_3 = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = logic.register_user('test_user_bot', '*****@*****.**', '111111', is_bot=True) self.account_bot = AccountPrototype.get_by_id(account_id) result, account_id, bundle_id = logic.register_user('test_user4') self.account_4 = AccountPrototype.get_by_id(account_id) CategoryPrototype.create(caption='category-1', slug=clans_settings.FORUM_CATEGORY_SLUG, order=0) self.clan_2 = ClanPrototype.create(self.account_2, abbr=u'abbr2', name=u'name2', motto=u'motto', description=u'description') self.clan_3 = ClanPrototype.create(self.account_3, abbr=u'abbr3', name=u'name3', motto=u'motto', description=u'description')
def setUp(self): super(ReadStateTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account() category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create(category=category, caption='subcat-caption', order=0) self.subcategory_2 = SubCategoryPrototype.create(category=category, caption='subcat-2-caption', order=0) self.thread = ThreadPrototype.create(self.subcategory, 'thread1-caption', self.account_2, 'thread-text') self.thread_2 = ThreadPrototype.create(self.subcategory, 'thread2-caption', self.account_2, 'thread-2-text') self.thread_3 = ThreadPrototype.create(self.subcategory_2, 'thread2-caption', self.account, 'thread-2-text')
def setUp(self): super(ThreadPrototypeTests, self).setUp() create_test_map() register_user('test_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('test_user') 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.thread = ThreadPrototype.create(self.subcategory, 'thread-caption', self.account, 'thread-text')
def setUp(self): super(SubscriptionPrototypeTests, self).setUp() create_test_map() self.account = self.accounts_factory.create_account() self.account_2 = self.accounts_factory.create_account() self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory_1 = SubCategoryPrototype.create(category=self.category, caption='subcat-1-caption', order=0) self.subcategory_2 = SubCategoryPrototype.create(category=self.category, caption='subcat-2-caption', order=1) self.thread_1_1 = ThreadPrototype.create(self.subcategory_1, 'thread-1-1-caption', self.account, 'thread-1-1-text') self.thread_1_2 = ThreadPrototype.create(self.subcategory_1, 'thread-1-2-caption', self.account, 'thread-1-2-text') self.thread_1_3 = ThreadPrototype.create(self.subcategory_1, 'thread-1-3-caption', self.account_2, 'thread-1-3-text') self.thread_2_1 = ThreadPrototype.create(self.subcategory_2, 'thread-2-1-caption', self.account, 'thread-2-1-text') self.thread_2_2 = ThreadPrototype.create(self.subcategory_2, 'thread-2-2-caption', self.account, 'thread-2-2-text')
def setUp(self): super(SubcategoryPrototypeUpdateTests, self).setUp() create_test_map() register_user('test_user', '*****@*****.**', '111111') register_user('checked_user', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('test_user') self.checked_account = AccountPrototype.get_by_nick('checked_user') self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory = SubCategoryPrototype.create(category=self.category, caption='subcat-caption', order=2) self.thread_1 = ThreadPrototype.create(self.subcategory, 'thread-1-caption', self.account, 'thread-1-text') self.thread_2 = ThreadPrototype.create(self.subcategory, 'thread-2-caption', self.account, 'thread-2-text')
def setUp(self): super(ReadStateTests, self).setUp() create_test_map() register_user("user_1", "*****@*****.**", "111111") register_user("user_2", "*****@*****.**", "111111") self.account = AccountPrototype.get_by_nick("user_1") self.account_2 = AccountPrototype.get_by_nick("user_2") category = CategoryPrototype.create(caption="cat-caption", slug="cat-slug", order=0) self.subcategory = SubCategoryPrototype.create(category=category, caption="subcat-caption", order=0) self.subcategory_2 = SubCategoryPrototype.create(category=category, caption="subcat-2-caption", order=0) self.thread = ThreadPrototype.create(self.subcategory, "thread1-caption", self.account_2, "thread-text") self.thread_2 = ThreadPrototype.create(self.subcategory, "thread2-caption", self.account_2, "thread-2-text") self.thread_3 = ThreadPrototype.create(self.subcategory_2, "thread2-caption", self.account, "thread-2-text")
def setUp(self): super(NewForumThreadTests, self).setUp() create_test_map() self.account_1 = self.accounts_factory.create_account() 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.thread = ThreadPrototype.create(self.subcategory, 'thread_1-caption', self.account_1, 'thread-text') self.message = MessagePrototype.get_priority_message()
def test_delete(self): category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) subcategory_1 = SubCategoryPrototype.create(category=category, caption='subcat-1-caption', order=2) subcategory_2 = SubCategoryPrototype.create(category=category, caption='subcat-2-caption', order=1) thread_1_1 = ThreadPrototype.create(subcategory_1, 'thread-1_1-caption', self.account, 'thread-1_1-text') thread_1_2 = ThreadPrototype.create(subcategory_1, 'thread-1_2-caption', self.account, 'thread-1_2-text') thread_2_1 = ThreadPrototype.create(subcategory_2, 'thread-2_1-caption', self.account, 'thread-2_1-text') subcategory_1.delete() self.assertFalse(ThreadPrototype._db_filter(id__in=(thread_1_1.id, thread_1_2.id)).exists()) self.assertTrue(ThreadPrototype._db_filter(id=thread_2_1.id).exists()) self.assertFalse(SubCategoryPrototype._db_filter(id=subcategory_1.id).exists()) self.assertTrue(SubCategoryPrototype._db_filter(id=subcategory_2.id).exists())
def setUp(self): super(SubscriptionPrototypeTests, self).setUp() create_test_map() register_user('user_1', '*****@*****.**', '111111') register_user('user_2', '*****@*****.**', '111111') self.account = AccountPrototype.get_by_nick('user_1') self.account_2 = AccountPrototype.get_by_nick('user_2') self.category = CategoryPrototype.create(caption='cat-caption', slug='cat-slug', order=0) self.subcategory_1 = SubCategoryPrototype.create(category=self.category, caption='subcat-1-caption', order=0) self.subcategory_2 = SubCategoryPrototype.create(category=self.category, caption='subcat-2-caption', order=1) self.thread_1_1 = ThreadPrototype.create(self.subcategory_1, 'thread-1-1-caption', self.account, 'thread-1-1-text') self.thread_1_2 = ThreadPrototype.create(self.subcategory_1, 'thread-1-2-caption', self.account, 'thread-1-2-text') self.thread_1_3 = ThreadPrototype.create(self.subcategory_1, 'thread-1-3-caption', self.account_2, 'thread-1-3-text') self.thread_2_1 = ThreadPrototype.create(self.subcategory_2, 'thread-2-1-caption', self.account, 'thread-2-1-text') self.thread_2_2 = ThreadPrototype.create(self.subcategory_2, 'thread-2-2-caption', self.account, 'thread-2-2-text')