def test_create_comment_given_valid_details_creates_comment_triangulation( create_users, create_post): user_id = 1 post_id = 1 comment_text = "Nice Post" sql_storage = StorageImplementation() comment_id = sql_storage.create_comment( user_id=user_id, post_id=post_id, comment_text=comment_text) comment = Comment.objects.get(id=comment_id) assert comment.id == comment_id assert comment.user.id == user_id assert comment.post.id == post_id assert comment.comment_text == comment_text
def test_create_comment_with_valid_details_returns_comment_id( create_users, create_posts): # Arrange user_id = 1 post_id = 1 comment_content = 'Comment content' storage = StorageImplementation() # Act comment_id = storage.create_comment(user_id=user_id, post_id=post_id, comment_content=comment_content) # Assert comment = Comment.objects.get(id=comment_id) assert comment_id == comment.id