MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_influx_db_integration

Function test_influx_db_integration

chirpstack/src/api/application.rs:2207–2364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 12

prepareFunction · 0.85
get_applicationFunction · 0.85
to_stringMethod · 0.80
unwrapMethod · 0.80
list_integrationsMethod · 0.80
get_userFunction · 0.70
get_requestFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected