Exemplo n.º 1
0
    def _mock_link(id=1, author_id=1, sr_id=1, **kwargs):
        kwargs['id'] = id
        kwargs['author_id'] = author_id
        kwargs['sr_id'] = sr_id

        link = Link(**kwargs)
        VByName.run = MagicMock(return_value=link)

        sr = Subreddit(id=sr_id)
        link.subreddit = sr

        return link
Exemplo n.º 2
0
    def _mock_comment(id=1, author_id=1, link_id=1, sr_id=1, **kwargs):
        kwargs['id'] = id
        kwargs['author_id'] = author_id
        kwargs['link_id'] = link_id

        comment = Comment(**kwargs)
        VByName.run = MagicMock(return_value=comment)

        link = Link(id=link_id)
        Link._byID = MagicMock(return_value=link)

        sr = Subreddit(id=sr_id)
        comment.subreddit_slow = MagicMock(return_value=sr)
        comment.subreddit_slow.is_moderator = MagicMock(return_value=False)
        link.subreddit = sr

        return comment