-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure redirect to index if no justice id regardless of route hit (#1283
) * ensure redirect to index if no justice id regardless of route hit * updated code based on Michaels suggestions * added unit tests for success url property
- Loading branch information
1 parent
edc2834
commit 29036d2
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
from controlpanel.oidc import StateMismatchHandler | ||
from unittest.mock import Mock | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"email, success_url", | ||
[ | ||
("", "/"), | ||
("[email protected]", "/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 |