Ejemplo n.º 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()
Ejemplo n.º 2
0
def api_wrapper(*args, **kwargs):
    comment_id = kwargs['comment_id']
    user = kwargs['user']
    react_type = kwargs['request_data']['reaction_type']
    # print(comment_id)
    from fb_post.models_utility_functions import react_to_comment
    react = react_to_comment(user, comment_id, react_type)
    if react == None:
        return
    return {"id": react.id}
Ejemplo n.º 3
0
    def test_case(self):
        super(TestCase02PostReactToCommentAPITestCase,
              self).setupUser('username', 'password')
        from fb_post.models_utility_functions import create_post, add_comment, react_to_comment
        self.post = create_post(self.foo_user.id, "content")
        self.comment = add_comment(self.post.id, self.foo_user.id, "comment")
        self.react = react_to_comment(self.foo_user, self.comment.id, "haha")
        TEST_CASE['request']['path_params']['comment_id'] = self.comment.id

        from fb_post.models_utility_functions import Reaction
        self.count_before_reaction = Reaction.objects.all().count()
        self.default_test_case()