def test_success_only_true(self):
        class TestClass():
            def test_method(self):
                pass

        @mockfn
        def post_hook_mock(*args, **kwargs):
            pass

        post_hook = HookManager.success_only(post_hook_mock)

        test_method_manager = HookManager(TestClass, 'test_method')
        test_method_manager.register_post_hook(post_hook)
        test_method_manager.wrap_method()

        test_obj = TestClass()
        assert not post_hook_mock.called
        test_obj.test_method()
        assert post_hook_mock.called
    def test_success_only_false(self):
        class TestClass():
            def test_method(self):
                raise Exception()

        @mockfn
        def post_hook_mock(*args, **kwargs):
            pass

        post_hook = HookManager.success_only(post_hook_mock)

        test_method_manager = HookManager(TestClass, 'test_method')
        test_method_manager.register_post_hook(post_hook)
        test_method_manager.wrap_method()

        test_obj = TestClass()
        assert not post_hook_mock.called
        with raises(Exception):
            test_obj.test_method()
        assert not post_hook_mock.called