def test_reply_to_comment_for_reply_comment(user2, comment, reply_comment, post): #arrange #act reply_to_comment(2, 2, "ofcourse thats true") parent_id = 1 #assert assert Comment.objects.get( content="ofcourse thats true").parent_comment_id == parent_id
def test_reply_to_comment_for_direct_comment(user, comment, post): #arrange #act reply_id = reply_to_comment(1, 1, "u need to accept because thats true") #assert assert Comment.objects.get( content="u need to accept because thats true").id == reply_id
def api_wrapper(*args, **kwargs): # ---------MOCK IMPLEMENTATION--------- comment_id = kwargs['comment_id'] user = kwargs['user'] request_data = kwargs['request_data'] comment_content=request_data['content'] try: reply_comment_id = reply_to_comment( user_id=user.id, comment_id=comment_id, reply_content=comment_content ) except InvalidCommentException: raise NotFound(*INVALID_COMMENT_ID) except InvalidReplyContent: raise BadRequest(*INVALID_REPLY_CONTENT) else: data = json.dumps({"comment_id": reply_comment_id}) response = HttpResponse(data, status=201) return response """
def test_reply_to_comment_reply_content_invalid(user, comment, post): #arrange #act with pytest.raises(InvalidReplyContent): reply_to_comment(1, 1, "")
def test_reply_to_comment_comment_id_invalid(user): #arrange #act with pytest.raises(InvalidCommentException): reply_to_comment(1, 3, "i too agree")
def test_reply_to_comment_user_id_invalid(): #arrange #act with pytest.raises(InvalidUserException): reply_to_comment(3, 1, "i too agree")