(self, db)
| 3 | |
| 4 | class TestDb: |
| 5 | def testCheckTables(self, db): |
| 6 | tables = [row["name"] for row in db.execute("SELECT name FROM sqlite_master WHERE type='table'")] |
| 7 | assert "keyvalue" in tables # To store simple key -> value |
| 8 | assert "json" in tables # Json file path registry |
| 9 | assert "test" in tables # The table defined in dbschema.json |
| 10 | |
| 11 | # Verify test table |
| 12 | cols = [col["name"] for col in db.execute("PRAGMA table_info(test)")] |
| 13 | assert "test_id" in cols |
| 14 | assert "title" in cols |
| 15 | |
| 16 | # Add new table |
| 17 | assert "newtest" not in tables |
| 18 | db.schema["tables"]["newtest"] = { |
| 19 | "cols": [ |
| 20 | ["newtest_id", "INTEGER"], |
| 21 | ["newtitle", "TEXT"], |
| 22 | ], |
| 23 | "indexes": ["CREATE UNIQUE INDEX newtest_id ON newtest(newtest_id)"], |
| 24 | "schema_changed": 1426195822 |
| 25 | } |
| 26 | db.checkTables() |
| 27 | tables = [row["name"] for row in db.execute("SELECT name FROM sqlite_master WHERE type='table'")] |
| 28 | assert "test" in tables |
| 29 | assert "newtest" in tables |
| 30 | |
| 31 | def testQueries(self, db): |
| 32 | # Test insert |
nothing calls this directly
no test coverage detected