MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_information_schema_tables

Function test_information_schema_tables

tests/information_schema_test.rs:47–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46#[tokio::test]
47async fn test_information_schema_tables() {
48 let _ = env_logger::builder().is_test(true).try_init();
49
50 let server = common::setup_test_server_with_init(|db| {
51 Box::pin(async move {
52 // Create a test table and view
53 db.execute("CREATE TABLE test_table (id INTEGER, name TEXT)").await?;
54 db.execute("CREATE VIEW test_view AS SELECT id FROM test_table").await?;
55 Ok(())
56 })
57 }).await;
58 let client = &server.client;
59
60 // Test SELECT table_name, table_type FROM information_schema.tables
61 let rows = client.query("SELECT table_name, table_type FROM information_schema.tables", &[]).await.unwrap();
62
63 // Should return at least our test table and view
64 assert!(rows.len() >= 2);
65
66 // Check that our table and view are present with correct types
67 let table_info: Vec<(&str, &str)> = rows.iter()
68 .map(|row| (row.get::<_, &str>(0), row.get::<_, &str>(1)))
69 .collect();
70
71 assert!(table_info.contains(&("test_table", "BASE TABLE")));
72 assert!(table_info.contains(&("test_view", "VIEW")));
73}
74
75#[tokio::test]
76async fn test_information_schema_tables_all_columns() {

Callers

nothing calls this directly

Calls 3

executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected