Skip to content

Instantly share code, notes, and snippets.

View test_view.py
@pytest.mark.django_db
def test_not_confirmed_redirects_anonymous_user_to_dashboard(anon_user):
view = Mock()
redirect = "/login/"
request = create_get_request(redirect, anon_user)
response = not_confirmed(view)(request)
assert not view.called
assert response.redirect == redirect
View sample_view.py
@not_confirmed
def my_view(request):
pass