()
| 45 | |
| 46 | #[tokio::test] |
| 47 | async 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] |
| 76 | async fn test_information_schema_tables_all_columns() { |
nothing calls this directly
no test coverage detected