Exemplo n.º 1
0
    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')
Exemplo n.º 2
0
    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')
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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')
Exemplo n.º 5
0
    def test_create_remove_multiple_clans(self):
        account_2 = self.accounts_factory.create_account()
        clan_2 = ClanPrototype.create(account_2,
                                      abbr='abbr2',
                                      name='clan-name-2',
                                      motto='clan-2-motto',
                                      description='clan-2-description')

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 2)
        self.assertNotEqual(
            ForumPermissionPrototype.get_for(self.account.id,
                                             self.clan.forum_subcategory_id),
            None)
        self.assertNotEqual(
            ForumPermissionPrototype.get_for(account_2.id,
                                             clan_2.forum_subcategory_id),
            None)

        clan_2.remove()

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 1)

        self.assertNotEqual(
            ForumPermissionPrototype.get_for(self.account.id,
                                             self.clan.forum_subcategory_id),
            None)
        self.assertEqual(
            ForumPermissionPrototype.get_for(account_2.id,
                                             clan_2.forum_subcategory_id),
            None)
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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')
Exemplo n.º 8
0
    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')
Exemplo n.º 9
0
    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')
Exemplo n.º 10
0
    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('*****@*****.**')
Exemplo n.º 11
0
    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')
Exemplo n.º 12
0
    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')
Exemplo n.º 13
0
    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')
Exemplo n.º 14
0
    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"
        )
Exemplo n.º 15
0
    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)
Exemplo n.º 16
0
    def test_create_remove_multiple_clans(self):
        account_2 = self.accounts_factory.create_account()
        clan_2 = ClanPrototype.create(account_2, abbr='abbr2', name='clan-name-2', motto='clan-2-motto', description='clan-2-description')

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 2)
        self.assertNotEqual(ForumPermissionPrototype.get_for(self.account.id, self.clan.forum_subcategory_id), None)
        self.assertNotEqual(ForumPermissionPrototype.get_for(account_2.id, clan_2.forum_subcategory_id), None)

        clan_2.remove()

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 1)

        self.assertNotEqual(ForumPermissionPrototype.get_for(self.account.id, self.clan.forum_subcategory_id), None)
        self.assertEqual(ForumPermissionPrototype.get_for(account_2.id, clan_2.forum_subcategory_id), None)
Exemplo n.º 17
0
    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')
Exemplo n.º 18
0
    def test_create_remove_multiple_clans(self):

        result, account_id, bundle_id = register_user('test_user_2', '*****@*****.**', '111111')

        account_2 = AccountPrototype.get_by_id(account_id)
        clan_2 = ClanPrototype.create(account_2, abbr=u'abbr2', name=u'clan-name-2', motto='clan-2-motto', description=u'clan-2-description')

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 2)
        self.assertNotEqual(ForumPermissionPrototype.get_for(self.account.id, self.clan.forum_subcategory_id), None)
        self.assertNotEqual(ForumPermissionPrototype.get_for(account_2.id, clan_2.forum_subcategory_id), None)

        clan_2.remove()

        self.assertEqual(SubCategoryPrototype._db_count(), 2)
        self.assertEqual(ForumPermissionPrototype._db_count(), 1)

        self.assertNotEqual(ForumPermissionPrototype.get_for(self.account.id, self.clan.forum_subcategory_id), None)
        self.assertEqual(ForumPermissionPrototype.get_for(account_2.id, clan_2.forum_subcategory_id), None)
Exemplo n.º 19
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
        })
Exemplo n.º 20
0
 def create_clan(self, owner, i):
     return ClanPrototype.create(owner=owner,
                                 abbr='a-%d' % i,
                                 name='name-%d' % i,
                                 motto='motto-%d' % i,
                                 description='[b]description-%d[/b]' % i)
Exemplo n.º 21
0
 def create_clan(self, owner, i):
     return ClanPrototype.create(owner=owner,
                                 abbr=u'a-%d' % i,
                                 name=u'name-%d' % i,
                                 motto=u'motto-%d' %i ,
                                 description=u'[b]description-%d[/b]' % i)