Mocking out a postgres connection in session state with pytest/monkeypatch

I am interested in testing flip_burger()'s ability to execute an INSERT statement and parse the output. This is also a small example, I perform other similar insertions throughout my app, so having this testing ability would prove overall useful.

I’m mostly interested in mocking here since I can use it to replace the session object in a way that lets me keep my application code as-is.

The real question is, and apologies if I’ve buried the lede here, “how can I mock the context manager to deliver results akin to actually running the SQL command?” It’s not necessarily a streamlit problem, but I thought others might have experience with using streamlit’s session state in this way (storing a database connection).