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()
def test_case(self): from fb_post.models_utility_functions import Comment, create_post, add_comment self.foo_user = self._create_user("username", "password") self.post = create_post(self.foo_user.id, "content") self.comment = add_comment(self.post.id, self.foo_user.id, "comment") print(self.comment.id) print("s") TEST_CASE['request']['path_params']['comment_id'] = self.comment.id self.count_before_comment = Comment.objects.all().count() self.default_test_case()
def api_wrapper(*args, **kwargs): print("sdfsa") post_id = kwargs['post_id'] user = kwargs['user'].id comment_content = kwargs['request_data']['comment_content'] from fb_post.models_utility_functions import add_comment comment = add_comment(post_id, user, comment_content) return {"id": comment.id}
def test_case(self): super(TestCase01PostReactToCommentAPITestCase, self).setupUser('username', 'password') from fb_post.models_utility_functions import create_post, add_comment self.post = create_post(self.foo_user.id, "content") self.comment = add_comment(self.post.id, self.foo_user.id, "comment") 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()
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()