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

Function test_pilot_things_integration

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

Source from the content-addressed store, hash-verified

3039
3040 #[tokio::test]
3041 async fn test_pilot_things_integration() {
3042 let _guard = test::prepare().await;
3043 let app = get_application().await;
3044 let u = get_user().await;
3045 let service = Application::new(RequestValidator::new());
3046
3047 // create
3048 let create_req = get_request(
3049 &u.id,
3050 api::CreatePilotThingsIntegrationRequest {
3051 integration: Some(api::PilotThingsIntegration {
3052 application_id: app.id.to_string(),
3053 server: "http://pilotthings".into(),
3054 token: "secrettoken".into(),
3055 }),
3056 },
3057 );
3058 let _ = service
3059 .create_pilot_things_integration(create_req)
3060 .await
3061 .unwrap();
3062
3063 // get
3064 let get_req = get_request(
3065 &u.id,
3066 api::GetPilotThingsIntegrationRequest {
3067 application_id: app.id.to_string(),
3068 },
3069 );
3070 let get_resp = service.get_pilot_things_integration(get_req).await.unwrap();
3071 let get_resp = get_resp.get_ref();
3072 assert_eq!(
3073 Some(api::PilotThingsIntegration {
3074 application_id: app.id.to_string(),
3075 server: "http://pilotthings".into(),
3076 token: "secrettoken".into(),
3077 }),
3078 get_resp.integration
3079 );
3080
3081 // update
3082 let update_req = get_request(
3083 &u.id,
3084 api::UpdatePilotThingsIntegrationRequest {
3085 integration: Some(api::PilotThingsIntegration {
3086 application_id: app.id.to_string(),
3087 server: "http://pilotthings-updated".into(),
3088 token: "secrettoken".into(),
3089 }),
3090 },
3091 );
3092 let _ = service
3093 .update_pilot_things_integration(update_req)
3094 .await
3095 .unwrap();
3096
3097 // get
3098 let get_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