()
| 153 | |
| 154 | #[tokio::test] |
| 155 | async fn copy_to_query_form() { |
| 156 | let srv = TestServer::start().await; |
| 157 | |
| 158 | seed_collection(&srv, "copy_to_query").await; |
| 159 | |
| 160 | let (_dir, out_path) = temp_output_path(".ndjson"); |
| 161 | // Export only rows where id < 3. |
| 162 | srv.exec(&format!( |
| 163 | "COPY (SELECT * FROM copy_to_query WHERE id < 3) TO '{out_path}'" |
| 164 | )) |
| 165 | .await |
| 166 | .expect("COPY query-form TO NDJSON"); |
| 167 | |
| 168 | let content = std::fs::read_to_string(&out_path).expect("read output file"); |
| 169 | let count = content.lines().filter(|l| !l.trim().is_empty()).count(); |
| 170 | assert_eq!(count, 2, "expected 2 rows matching id < 3"); |
| 171 | } |
| 172 | |
| 173 | // ── test 6: path traversal rejection ──────────────────────────────────────── |
| 174 |
nothing calls this directly
no test coverage detected