File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,8 +183,7 @@ class Session(Timestamped, Base):
183183 expiration_time = Column (DateTime (timezone = False ), nullable = False )
184184 principal_id = Column (Integer , ForeignKey ("principals.id" ), nullable = False )
185185 revoked = Column (Boolean , default = False , nullable = False )
186- # State allows for custom authenticator information to be stored in the session.
187- state = Column (JSONVariant , nullable = False )
186+ state = Column (JSONVariant , default = dict , nullable = False )
188187 principal : Mapped [Principal ] = relationship (back_populates = "sessions" , lazy = "joined" )
189188
190189
Original file line number Diff line number Diff line change @@ -62,13 +62,7 @@ def test_session_state_defaults_to_empty_dict(sqlite_session):
6262 db .refresh (session )
6363 # Server default is '{}' so a session created without an explicit state
6464 # must not present as None to the ORM.
65- assert reloaded_state (session ) == {}
66-
67-
68- def reloaded_state (session ):
69- # SQLite may return None if the server_default has not been re-selected;
70- # normalize.
71- return session .state if session .state is not None else {}
65+ assert session .state == {}
7266
7367
7468def test_get_or_create_principal_creates_when_missing (sqlite_session ):
You can’t perform that action at this time.
0 commit comments