Skip to content

Commit

Permalink
Fix incorrect attr for user in LoginSession (missed in #1697) (#1938)
Browse files Browse the repository at this point in the history
Also fix/update imports and typing.
  • Loading branch information
jace authored Dec 8, 2023
1 parent 48ccb8d commit 89f2645
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions funnel/models/login_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
class LoginSessionError(Exception):
"""Base exception for user session errors."""

def __init__(self, login_session: LoginSession, *args) -> None:
self.login_session = login_session
super().__init__(login_session, *args)


class LoginSessionExpiredError(LoginSessionError):
"""This user session has expired and cannot be marked as currently active."""
Expand Down
2 changes: 1 addition & 1 deletion funnel/views/login_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _load_user():
# TODO: Force render of logout page to clear client-side data
logout_internal()
except LoginSessionInactiveUserError as exc:
inactive_user = exc.args[0].user
inactive_user = exc.login_session.account
if inactive_user.state.SUSPENDED:
flash(_("Your account has been suspended"))
elif inactive_user.state.DELETED:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def sort_key(item: pytest.Function) -> tuple[int, str]:
# as item.location == (file_path, line_no, function_name). However, pytest-bdd
# reports itself for file_path, so we can't use that and must extract the path
# from the test module instead
module_file = item.module.__file__
module_file = item.module.__file__ if item.module is not None else ''
for counter, path in enumerate(test_order):
if path in module_file:
return (counter, module_file)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/markdown/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def dump(cls) -> None:
if cls.test_map is not None:
for md_testname, data in cls.test_files.items():
data['expected_output'] = {
md_configname: tomlkit.api.string(case.output, multiline=True)
md_configname: tomlkit.string(case.output, multiline=True)
for md_configname, case in cls.test_map[md_testname].items()
}
(md_tests_data_root / md_testname).write_text(tomlkit.dumps(data))
Expand Down

0 comments on commit 89f2645

Please sign in to comment.