Helper function to set up a test environment with a custom prefix.
(initial_dbs: Vec<&str>)
| 40 | |
| 41 | /// Helper function to set up a test environment with a custom prefix. |
| 42 | async fn setup_test_server(initial_dbs: Vec<&str>) -> TestContext { |
| 43 | let prefix = "mock-test"; |
| 44 | // Create config with prefix |
| 45 | let mut defaults = HashMap::new(); |
| 46 | defaults.insert("prefix".to_string(), prefix.to_string()); |
| 47 | let config = ConfigResponse::new(defaults); |
| 48 | |
| 49 | let initial: Vec<String> = initial_dbs.iter().map(|s| s.to_string()).collect(); |
| 50 | // Start server with config |
| 51 | let server = start_mock_server( |
| 52 | "test_warehouse".to_string(), // warehouse |
| 53 | "/tmp/test_warehouse".to_string(), // data_path |
| 54 | config, |
| 55 | initial, |
| 56 | ) |
| 57 | .await; |
| 58 | let token = "test_token"; |
| 59 | let url = server.url().expect("Failed to get server URL"); |
| 60 | let mut options = Options::new(); |
| 61 | options.set("uri", &url); |
| 62 | options.set("warehouse", "test_warehouse"); |
| 63 | options.set("token.provider", "bear"); |
| 64 | options.set("token", token); |
| 65 | |
| 66 | let api = RESTApi::new(options, true) |
| 67 | .await |
| 68 | .expect("Failed to create RESTApi"); |
| 69 | |
| 70 | TestContext { server, api, url } |
| 71 | } |
| 72 | |
| 73 | // ==================== Database Tests ==================== |
| 74 | #[tokio::test] |
no test coverage detected