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

Function test_gcp_pub_sub_integration

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

Source from the content-addressed store, hash-verified

2619
2620 #[tokio::test]
2621 async fn test_gcp_pub_sub_integration() {
2622 let _guard = test::prepare().await;
2623 let app = get_application().await;
2624 let u = get_user().await;
2625 let service = Application::new(RequestValidator::new());
2626
2627 // create
2628 let create_req = get_request(
2629 &u.id,
2630 api::CreateGcpPubSubIntegrationRequest {
2631 integration: Some(api::GcpPubSubIntegration {
2632 application_id: app.id.to_string(),
2633 encoding: api::Encoding::Json.into(),
2634 credentials_file: "--credentials--".into(),
2635 project_id: "test-project".into(),
2636 topic_name: "test-topic".into(),
2637 }),
2638 },
2639 );
2640 let _ = service
2641 .create_gcp_pub_sub_integration(create_req)
2642 .await
2643 .unwrap();
2644
2645 // get
2646 let get_req = get_request(
2647 &u.id,
2648 api::GetGcpPubSubIntegrationRequest {
2649 application_id: app.id.to_string(),
2650 },
2651 );
2652 let get_resp = service.get_gcp_pub_sub_integration(get_req).await.unwrap();
2653 let get_resp = get_resp.get_ref();
2654 assert_eq!(
2655 Some(api::GcpPubSubIntegration {
2656 application_id: app.id.to_string(),
2657 encoding: api::Encoding::Json.into(),
2658 credentials_file: "--credentials--".into(),
2659 project_id: "test-project".into(),
2660 topic_name: "test-topic".into(),
2661 }),
2662 get_resp.integration
2663 );
2664
2665 // update
2666 let update_req = get_request(
2667 &u.id,
2668 api::UpdateGcpPubSubIntegrationRequest {
2669 integration: Some(api::GcpPubSubIntegration {
2670 application_id: app.id.to_string(),
2671 encoding: api::Encoding::Protobuf.into(),
2672 credentials_file: "--credentials--".into(),
2673 project_id: "test-project".into(),
2674 topic_name: "test-topic".into(),
2675 }),
2676 },
2677 );
2678 let _ = service

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