예제 #1
0
    def setUp(self):
        settings.OWS_LIMIT_THREAD = -1
        settings.OWS_LIMIT_COMMENT = -1
        settings.OWS_LIMIT_MSG_DAY = 999999
        self.create_users()
        self.article = db.Article(author=self.red_user,
                                  published=datetime.now(),
                                  title='article title',
                                  slug='article-slug',
                                  content='exciting article content')
        self.article.save()
        comment_list = api.comment_new(user=self.blue_user,
                                       article_slug=self.article.slug,
                                       parent_id=0,
                                       content=random_words(20))
        self.comment = db.Comment.objects.get(id=comment_list[0]['id'])

        # add a second comment
        api.comment_new(user=self.blue_user,
                        article_slug=self.article.slug,
                        parent_id=0,
                        content=random_words(20))

        self.carousel = db.Carousel()
        self.carousel.save()

        self.photo = db.Photo(carousel=self.carousel, caption='hello, world')
        self.photo.save()
예제 #2
0
    def setUp(self):
        settings.OWS_LIMIT_THREAD = -1
        settings.OWS_LIMIT_COMMENT = -1
        settings.OWS_LIMIT_MSG_DAY = 999999
        self.create_users()
        self.article = db.Article(author=self.red_user,
                                  published=datetime.now(),
                                  title='article title',
                                  slug='article-slug',
                                  content='exciting article content')
        self.article.save()
        comment_list = api.comment_new(user=self.blue_user,
                                       article_slug=self.article.slug,
                                       parent_id=0,
                                       content=random_words(20))
        self.comment = db.Comment.objects.get(id=comment_list[0]['id'])

        # add a second comment
        api.comment_new(user=self.blue_user,
                        article_slug=self.article.slug,
                        parent_id=0,
                        content=random_words(20))

        self.carousel = db.Carousel()
        self.carousel.save()

        self.photo = db.Photo(carousel=self.carousel, caption='hello, world')
        self.photo.save()
예제 #3
0
    def setUp(self):
        settings.OWS_LIMIT_THREAD = -1
        settings.OWS_LIMIT_COMMENT = -1
        settings.OWS_LIMIT_MSG_DAY = 999999
        self.create_users()
        self.article = db.Article(author=self.red_user,
                                  title='article title',
                                  slug='article-slug',
                                  content='exciting article content')
        self.article.save()
        comment_list = api.comment_new(user=self.blue_user,
                                       article_slug=self.article.slug,
                                       parent_id=0,
                                       content=random_words(20))
        self.comment = db.Comment.objects.get(id=comment_list[0]['id'])

        # add a second comment
        api.comment_new(user=self.blue_user,
                        article_slug=self.article.slug,
                        parent_id=0,
                        content=random_words(20))
예제 #4
0
 def setUp(self):
     self.create_users()
     self.article = db.Article(author=self.red_user,
                               title='article title',
                               slug='article-slug',
                               content='exciting article content')
     self.article.save()
     comment_list = api.comment_new(user=self.blue_user,
                                    article_slug=self.article.slug,
                                    parent_id=0,
                                    content=random_words(20))
     self.comment = db.Comment.objects.get(id=comment_list[0]['id'])
예제 #5
0
def add_content(N):
    """Add N articles and comments to the database, for testing etc."""
    settings.DEBUG = True
    users = [u for u in db.User.objects.all()]

    for i in range(N):
        a = api.article_new(user=random.choice(users),
                            title=random_words(5),
                            content=random_words(50),
                            is_forum=True)
        comment_ids = []
        for j in range(N):
            c = api.comment_new(user=random.choice(users),
                                article_slug=a[0]['slug'],
                                parent_id=random.choice([0] + comment_ids),
                                content=random_words(20))
            comment_ids.append(c[0]['id'])

            for k in range(N):
                api.comment_upvote(random.choice(users),
                                   random.choice(comment_ids))
                api.comment_downvote(random.choice(users),
                                   random.choice(comment_ids))
예제 #6
0
def add_content(N):
    """Add N articles and comments to the database, for testing etc."""
    settings.DEBUG = True
    users = [u for u in db.User.objects.all()]

    for i in range(N):
        a = api.article_new(user=random.choice(users),
                            title=random_words(5),
                            content=random_words(50),
                            is_forum=True)
        comment_ids = []
        for j in range(N):
            c = api.comment_new(user=random.choice(users),
                                article_slug=a[0]['slug'],
                                parent_id=random.choice([0] + comment_ids),
                                content=random_words(20))
            comment_ids.append(c[0]['id'])

            for k in range(N):
                api.comment_upvote(random.choice(users),
                                   random.choice(comment_ids))
                api.comment_downvote(random.choice(users),
                                     random.choice(comment_ids))