Test that STRICT is appended to CREATE TABLE in developer mode.
(node_factory)
| 662 | |
| 663 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "STRICT tables are SQLite3 specific") |
| 664 | def test_sqlite_strict_mode(node_factory): |
| 665 | """Test that STRICT is appended to CREATE TABLE in developer mode.""" |
| 666 | l1 = node_factory.get_node(options={'developer': None}) |
| 667 | |
| 668 | tables = l1.db_query("SELECT name, sql FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'") |
| 669 | |
| 670 | strict_tables = [t for t in tables if t['sql'] and 'STRICT' in t['sql']] |
| 671 | assert len(strict_tables) > 0, f"Expected at least one STRICT table in developer mode, found none out of {len(tables)}" |
| 672 | |
| 673 | known_strict_tables = ['version', 'forwards', 'payments', 'local_anchors', 'addresses'] |
| 674 | for table_name in known_strict_tables: |
| 675 | table_sql = next((t['sql'] for t in tables if t['name'] == table_name), None) |
| 676 | if table_sql: |
| 677 | assert 'STRICT' in table_sql, f"Expected table '{table_name}' to be STRICT in developer mode" |
| 678 | |
| 679 | |
| 680 | @unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "SQLite3-specific test") |