()
| 33 | |
| 34 | @pytest.fixture |
| 35 | def session_conn(): |
| 36 | conn = CLISessionDatabaseConnection( |
| 37 | connection=sqlite3.connect( |
| 38 | # Use an in-memory db for testing. |
| 39 | ':memory:', |
| 40 | check_same_thread=False, |
| 41 | isolation_level=None, |
| 42 | ), |
| 43 | ) |
| 44 | # Write an initial record. |
| 45 | conn.execute( |
| 46 | """ |
| 47 | INSERT OR REPLACE INTO session ( |
| 48 | key, session_id, timestamp |
| 49 | ) VALUES ('first_key', 'first_id', 5555555555) |
| 50 | """ |
| 51 | ) |
| 52 | # Overwrite host id with deterministic value for testing. |
| 53 | conn.execute( |
| 54 | """ |
| 55 | INSERT OR REPLACE INTO host_id ( |
| 56 | key, id |
| 57 | ) VALUES (0, 'my-hostname') |
| 58 | """ |
| 59 | ) |
| 60 | return conn |
| 61 | |
| 62 | |
| 63 | @pytest.fixture |
nothing calls this directly
no test coverage detected