Skip to content

Commit

Permalink
fix(session): reset also clears enrollment expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Mar 26, 2024
1 parent 271efc0 commit 73957a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions benefits/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def reset(request):
request.session[_AGENCY] = None
request.session[_ELIGIBILITY] = None
request.session[_ORIGIN] = reverse("core:index")
request.session[_ENROLLMENT_EXP] = None
request.session[_ENROLLMENT_TOKEN] = None
request.session[_ENROLLMENT_TOKEN_EXP] = None
request.session[_OAUTH_TOKEN] = None
Expand Down
3 changes: 3 additions & 0 deletions tests/pytest/core/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,14 @@ def test_reset_eligibility(app_request):

@pytest.mark.django_db
def test_reset_enrollment(app_request):
app_request.session[session._ENROLLMENT_EXP] = "1234567890"
app_request.session[session._ENROLLMENT_TOKEN] = "enrollmenttoken123"
app_request.session[session._ENROLLMENT_TOKEN_EXP] = "1234567890"

session.reset(app_request)

assert session.enrollment_expiry(app_request) is None
assert session.enrollment_reenrollment(app_request) is None
assert session.enrollment_token(app_request) is None
assert session.enrollment_token_expiry(app_request) is None
assert not session.enrollment_token_valid(app_request)
Expand Down

0 comments on commit 73957a4

Please sign in to comment.