mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-27 19:41:58 -06:00
Document parity plan and add engine unit tests
This commit is contained in:
32
Data/Engine/tests/test_sqlite_migrations.py
Normal file
32
Data/Engine/tests/test_sqlite_migrations.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import sqlite3
|
||||
import unittest
|
||||
|
||||
from Data.Engine.repositories.sqlite import migrations
|
||||
|
||||
|
||||
class MigrationTests(unittest.TestCase):
|
||||
def test_apply_all_creates_expected_tables(self) -> None:
|
||||
conn = sqlite3.connect(":memory:")
|
||||
try:
|
||||
migrations.apply_all(conn)
|
||||
cursor = conn.cursor()
|
||||
tables = {
|
||||
row[0]
|
||||
for row in cursor.execute(
|
||||
"SELECT name FROM sqlite_master WHERE type='table'"
|
||||
)
|
||||
}
|
||||
|
||||
self.assertIn("devices", tables)
|
||||
self.assertIn("refresh_tokens", tables)
|
||||
self.assertIn("enrollment_install_codes", tables)
|
||||
self.assertIn("device_approvals", tables)
|
||||
self.assertIn("scheduled_jobs", tables)
|
||||
self.assertIn("scheduled_job_runs", tables)
|
||||
self.assertIn("github_token", tables)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover - convenience for local runs
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user