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

Function test_things_board_integration

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

Source from the content-addressed store, hash-verified

2365
2366 #[tokio::test]
2367 async fn test_things_board_integration() {
2368 let _guard = test::prepare().await;
2369 let app = get_application().await;
2370 let u = get_user().await;
2371 let service = Application::new(RequestValidator::new());
2372
2373 // create
2374 let create_req = get_request(
2375 &u.id,
2376 api::CreateThingsBoardIntegrationRequest {
2377 integration: Some(api::ThingsBoardIntegration {
2378 application_id: app.id.to_string(),
2379 server: "http://thingsboard/".into(),
2380 }),
2381 },
2382 );
2383 let _ = service
2384 .create_things_board_integration(create_req)
2385 .await
2386 .unwrap();
2387
2388 // get
2389 let get_req = get_request(
2390 &u.id,
2391 api::GetThingsBoardIntegrationRequest {
2392 application_id: app.id.to_string(),
2393 },
2394 );
2395 let get_resp = service.get_things_board_integration(get_req).await.unwrap();
2396 let get_resp = get_resp.get_ref();
2397 assert_eq!(
2398 Some(api::ThingsBoardIntegration {
2399 application_id: app.id.to_string(),
2400 server: "http://thingsboard/".into(),
2401 }),
2402 get_resp.integration
2403 );
2404
2405 // update
2406 let update_req = get_request(
2407 &u.id,
2408 api::UpdateThingsBoardIntegrationRequest {
2409 integration: Some(api::ThingsBoardIntegration {
2410 application_id: app.id.to_string(),
2411 server: "http://thingsboard-updated/".into(),
2412 }),
2413 },
2414 );
2415 let _ = service
2416 .update_things_board_integration(update_req)
2417 .await
2418 .unwrap();
2419
2420 // get
2421 let get_req = get_request(
2422 &u.id,
2423 api::GetThingsBoardIntegrationRequest {
2424 application_id: app.id.to_string(),

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