예제 #1
0
    def test_case(self):
        from fb_post.models_utility_functions import create_post, react_to_post, add_comment, react_to_comment, \
            reply_to_comment
        self.foo_user = self._create_user("username", "password")
        self.foo_user1 = self._create_user("username1", "password")
        self.foo_user2 = self._create_user("username2", "password")

        self.post = create_post(self.foo_user.id, "post content")
        self.post2 = create_post(self.foo_user2.id, "post content")

        self.react1 = react_to_post(self.foo_user1, self.post.id, "haha")
        self.react2 = react_to_post(self.foo_user2, self.post.id, "haha")

        self.comment1 = add_comment(self.post.id, self.foo_user1.id,
                                    "comment 1")
        self.react_to_comment1 = react_to_comment(self.foo_user,
                                                  self.comment1.id, "haha")

        self.reply_to_comment1 = reply_to_comment(self.comment1.id,
                                                  self.foo_user2.id,
                                                  "reply for comment")
        self.react_to_comment1 = react_to_comment(self.foo_user1,
                                                  self.reply_to_comment1.id,
                                                  "haha")

        TEST_CASE['request']['path_params']['user_id'] = self.foo_user1.id

        self.default_test_case()
예제 #2
0
 def test_case(self):
     from fb_post.models_utility_functions import create_post, add_comment, reply_to_comment
     self.foo_user = self._create_user("username", "password")
     self.foo_user1 = self._create_user("username1", "password")
     self.foo_user2 = self._create_user("username2", "password")
     self.foo_user3 = self._create_user("username3", "password")
     self.post = create_post(self.foo_user.id, "post content")
     self.comment = add_comment(self.post.id, self.foo_user1.id,
                                "comment 1")
     self.reply1 = reply_to_comment(self.comment.id, self.foo_user1.id,
                                    "reply1")
     self.reply2 = reply_to_comment(self.comment.id, self.foo_user2.id,
                                    "reply2")
     self.reply3 = reply_to_comment(self.comment.id, self.foo_user3.id,
                                    "reply3")
     TEST_CASE['request']['query_params']['offset'] = 0
     TEST_CASE['request']['query_params']['limit'] = 2
     TEST_CASE['request']['path_params']['comment_id'] = self.comment.id
     self.default_test_case()
예제 #3
0
def api_wrapper(*args, **kwargs):
    comment_id = kwargs['comment_id']
    # print(comment_id)
    user = kwargs['user'].id
    comment_content = kwargs['request_data']['comment_content']
    print(comment_id)
    from fb_post.models_utility_functions import add_comment, reply_to_comment
    comment = reply_to_comment(comment_id, user, comment_content)
    from django.http.response import HttpResponse

    return {"id": comment.id}
예제 #4
0
 def test_case(self):
     from fb_post.models_utility_functions import Comment, create_post, add_comment, reply_to_comment
     self.foo_user = self._create_user("username", "password")
     self.foo_user2 = self._create_user("username2", "password")
     self.post = create_post(self.foo_user.id, "content")
     self.comment = add_comment(self.post.id, self.foo_user.id, "comment")
     self.reply = reply_to_comment(self.comment.id, self.foo_user2.id,
                                   "reply")
     print(self.comment.id)
     print("s")
     TEST_CASE['request']['path_params']['comment_id'] = self.reply.id
     self.count_before_comment = Comment.objects.all().count()
     self.default_test_case()