def test_get_success_url(self, kwargs):
        success_url = '/'.join('{{{0}}}'.format(k) for k in iterkeys(kwargs))

        instance = sqlalchemy.DeletionMixin()
        instance.success_url = success_url or None
        instance.object = type('foo', (object,), {})()

        for k, v in iteritems(kwargs):
            setattr(instance.object, k, v)

        if not success_url:
            with pytest.raises(NotImplementedError) as excinfo:
                instance.get_success_url()

            error = ('DeletionMixin requires either a definition of '
                     "'success_url' or an implementation of "
                     "'get_success_url()'")

            assert excinfo.value.args[0] == error
        else:
            assert instance.get_success_url() == success_url.format(**kwargs)
    def test_get_redirect_url_with_url(self, kwargs):
        url = '/'.join('{{{0}}}'.format(k) for k in iterkeys(kwargs))

        instance = core.RedirectView(url=url)

        assert instance.get_redirect_url(**kwargs) == url.format(**kwargs)