from flask import g from atlas_um.auth import models from atlas_um.auth.utils import current_user class TestCurrentUser: def test_current_user_authenticated(self, app, faker): test_user = models.User(faker.pystr(), []) with app.test_request_context(): g.user = test_user assert current_user == test_user assert current_user.is_authenticated def test_current_user_anonymous(self, app, mocker): with app.test_request_context(): assert not current_user.is_authenticated