def test_invalid_reply_to_seed(self): reddit = Login.create_reddit_object() url = "https://www.reddit.com/r/AskReddit/comments/md0ny3/what_nonsensical_invasive_thoughts_do_you_have/" forest = Comments.Forest( reddit.submission(url = url), url ) metadata = { "body": "A test node.", "id": "test", "parent_id": "t1_inv@l1d", } reply = Comments.CommentNode(metadata) EncodeNode().encode(reply) try: forest.seed(reply) assert False except IndexError: assert True assert len(forest.root.replies) == 0
def test_init_method_set_root(self): reddit = Login.create_reddit_object() url = "https://www.reddit.com/r/AskReddit/comments/md0ny3/what_nonsensical_invasive_thoughts_do_you_have/" forest = Comments.Forest(reddit.submission(url=url), url) assert getattr(forest.root, "id") == "md0ny3"