()
| 2205 | |
| 2206 | #[tokio::test] |
| 2207 | async fn test_influx_db_integration() { |
| 2208 | let _guard = test::prepare().await; |
| 2209 | let app = get_application().await; |
| 2210 | let u = get_user().await; |
| 2211 | let service = Application::new(RequestValidator::new()); |
| 2212 | |
| 2213 | // create |
| 2214 | let create_req = get_request( |
| 2215 | &u.id, |
| 2216 | api::CreateInfluxDbIntegrationRequest { |
| 2217 | integration: Some(api::InfluxDbIntegration { |
| 2218 | application_id: app.id.to_string(), |
| 2219 | endpoint: "http://influxdb/".into(), |
| 2220 | db: "testdb".into(), |
| 2221 | username: "testuser".into(), |
| 2222 | password: "testpw".into(), |
| 2223 | retention_policy_name: "DEFAULT".into(), |
| 2224 | precision: api::InfluxDbPrecision::S.into(), |
| 2225 | version: api::InfluxDbVersion::Influxdb1.into(), |
| 2226 | token: "testtoken".into(), |
| 2227 | organization: "testorg".into(), |
| 2228 | bucket: "testbucket".into(), |
| 2229 | }), |
| 2230 | }, |
| 2231 | ); |
| 2232 | let _ = service |
| 2233 | .create_influx_db_integration(create_req) |
| 2234 | .await |
| 2235 | .unwrap(); |
| 2236 | |
| 2237 | // get |
| 2238 | let get_req = get_request( |
| 2239 | &u.id, |
| 2240 | api::GetInfluxDbIntegrationRequest { |
| 2241 | application_id: app.id.to_string(), |
| 2242 | }, |
| 2243 | ); |
| 2244 | let get_resp = service.get_influx_db_integration(get_req).await.unwrap(); |
| 2245 | let get_resp = get_resp.get_ref(); |
| 2246 | assert_eq!( |
| 2247 | Some(api::InfluxDbIntegration { |
| 2248 | application_id: app.id.to_string(), |
| 2249 | endpoint: "http://influxdb/".into(), |
| 2250 | db: "testdb".into(), |
| 2251 | username: "testuser".into(), |
| 2252 | password: "testpw".into(), |
| 2253 | retention_policy_name: "DEFAULT".into(), |
| 2254 | precision: api::InfluxDbPrecision::S.into(), |
| 2255 | version: api::InfluxDbVersion::Influxdb1.into(), |
| 2256 | token: "testtoken".into(), |
| 2257 | organization: "testorg".into(), |
| 2258 | bucket: "testbucket".into(), |
| 2259 | }), |
| 2260 | get_resp.integration |
| 2261 | ); |
| 2262 | |
| 2263 | // update |
| 2264 | let update_req = get_request( |
nothing calls this directly
no test coverage detected