Exemple #1
0
    def test_is_reply_with_reply(self, comment_mock):

        comment = Mock()
        comment.commented_on = 2
        comment_mock.objects.get.return_value = comment

        post_storage_object = PostStorageImpl()
        response = post_storage_object.is_reply(3)

        comment_mock.objects.get.assert_called_once_with(pk=3)
        assert response == True
Exemple #2
0
    def test_is_reply_with_comment(self, comment_mock):

        comment = create_autospec(Comment)
        comment.commented_on = None
        comment_mock.objects.get.return_value = comment

        post_storage_object = PostStorageImpl()
        response = post_storage_object.is_reply(3)

        comment_mock.objects.get.assert_called_once_with(pk=3)
        assert response == False