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

Function test_aws_sns_integration

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

Source from the content-addressed store, hash-verified

2758
2759 #[tokio::test]
2760 async fn test_aws_sns_integration() {
2761 let _guard = test::prepare().await;
2762 let app = get_application().await;
2763 let u = get_user().await;
2764 let service = Application::new(RequestValidator::new());
2765
2766 // create
2767 let create_req = get_request(
2768 &u.id,
2769 api::CreateAwsSnsIntegrationRequest {
2770 integration: Some(api::AwsSnsIntegration {
2771 application_id: app.id.to_string(),
2772 encoding: api::Encoding::Json.into(),
2773 region: "eu-west1".into(),
2774 access_key_id: "keyid".into(),
2775 secret_access_key: "secretkey".into(),
2776 topic_arn: "topicarn".into(),
2777 }),
2778 },
2779 );
2780 let _ = service
2781 .create_aws_sns_integration(create_req)
2782 .await
2783 .unwrap();
2784
2785 // get
2786 let get_req = get_request(
2787 &u.id,
2788 api::GetAwsSnsIntegrationRequest {
2789 application_id: app.id.to_string(),
2790 },
2791 );
2792 let get_resp = service.get_aws_sns_integration(get_req).await.unwrap();
2793 let get_resp = get_resp.get_ref();
2794 assert_eq!(
2795 Some(api::AwsSnsIntegration {
2796 application_id: app.id.to_string(),
2797 encoding: api::Encoding::Json.into(),
2798 region: "eu-west1".into(),
2799 access_key_id: "keyid".into(),
2800 secret_access_key: "secretkey".into(),
2801 topic_arn: "topicarn".into(),
2802 }),
2803 get_resp.integration
2804 );
2805
2806 // update
2807 let update_req = get_request(
2808 &u.id,
2809 api::UpdateAwsSnsIntegrationRequest {
2810 integration: Some(api::AwsSnsIntegration {
2811 application_id: app.id.to_string(),
2812 encoding: api::Encoding::Protobuf.into(),
2813 region: "eu-west1".into(),
2814 access_key_id: "keyid".into(),
2815 secret_access_key: "secretkey".into(),
2816 topic_arn: "topicarn".into(),
2817 }),

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