Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(headless): Do not create an empty session in app context on logout #3800

Merged
merged 1 commit into from
May 13, 2024

Conversation

joonhyungshin
Copy link
Contributor

Submitting Pull Requests

General

  • Make sure you use semantic commit messages.
    Examples: "fix(google): Fixed foobar bug", "feat(accounts): Added foobar feature".
  • All Python code must formatted using Black, and clean from pep8 and isort issues.
  • JavaScript code should adhere to StandardJS.
  • If your changes are significant, please update ChangeLog.rst.
  • If your change is substantial, feel free to add yourself to AUTHORS.

Description

This commit complements #3785 . Even though the headless API won't attach a session token when user logs out, the empty session is still created in the database upon exiting the context manager authentication_context(). This patch fixes this by also checking if the session is empty within the context manager.

Note: this behavior is quite tricky to test, because normally there is no way to access the 'ghost' session. If the session backend is guaranteed to be database-backed, then one way is to check the number of sessions before and after logout. The test code may be slightly messy though - I'll add a test if requested.

@coveralls
Copy link

Coverage Status

coverage: 95.545%. remained the same
when pulling cc4d560 on joonhyungshin:fix-empty-session
into 2a9790a on pennersr:main.

@pennersr pennersr merged commit e2307ba into pennersr:main May 13, 2024
58 checks passed
@joonhyungshin joonhyungshin deleted the fix-empty-session branch May 13, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants