diff --git a/tests/test_oidc.py b/tests/test_oidc.py new file mode 100644 index 000000000..7f0768fee --- /dev/null +++ b/tests/test_oidc.py @@ -0,0 +1,21 @@ +import pytest +from controlpanel.oidc import StateMismatchHandler +from unittest.mock import Mock + + +@pytest.mark.parametrize( + "email, success_url", + [ + ("", "/"), + ("example@justice.gov.uk", "/tools/"), + ], +) +def test_success_url(users, email, success_url): + request = Mock() + request.session.get.return_value = "/tools/" + user = users["normal_user"] + user.justice_email = email + view = StateMismatchHandler() + view.request = request + view.user = user + assert view.success_url == success_url