Skip to content

Conversation

@omosola
Copy link
Contributor

@omosola omosola commented Sep 18, 2025

Opening for discussion

Refactoring of (and some fixes in) the auth module, including tests.
Expanding test suite to cover more cases, and correcting existing tests.
Now with clean test suite runs. ✅

Added notes along the PR for main areas to focus on.

@omosola omosola force-pushed the refactor/auth branch 4 times, most recently from 516de10 to 09d0287 Compare September 20, 2025 11:02
@omosola omosola force-pushed the refactor/auth branch 9 times, most recently from 69034ba to 80e249a Compare September 20, 2025 11:40
@omosola omosola marked this pull request as ready for review September 20, 2025 11:40
@omosola omosola force-pushed the refactor/auth branch 2 times, most recently from 1d21e48 to 9515813 Compare September 20, 2025 12:02
Copy link
Member

@josvandervelde josvandervelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Omosola! Some nice improvements. There are some problems that don't surface when using the unittests - let me know if I can be of any help.

session.commit()
return jsonify({
"msg": "API Key updated",
"apikey": user.session_hash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for other reviewers: adding the apikey here makes sure that the frontend can show the new api-key to the user.


ctx.pop()


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but the current tests seem to assume that the user sets the environment variable DO_SEND_MAIL=False.

Adding this code fixes that issue:

from server.public import views

@pytest.fixture(scope="session", autouse=True)
def set_env():
    with patch.object(views, "DO_SEND_EMAIL", False) as _fixture:
        yield _fixture

@omosola
Copy link
Contributor Author

omosola commented Nov 19, 2025

Thanks for the review @josvandervelde! A couple of changes are related to previous implementation decisions that I left alone for this PR since I wasn't sure about the reasons behind some of those choices. I didn't want to touch too much existing decision logic in this PR.

My main focus for this PR was getting the user test suite running cleanly and finishing up unfinished implementations discovered through those updated tests (and aligning them with the old app's functionality).

All good comments/points, though! I'll make those changes, but I might put some of them in a separate PR.

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.

2 participants