()
| 3300 | |
| 3301 | #[tokio::test] |
| 3302 | async fn test_blynk_integration() { |
| 3303 | let _guard = test::prepare().await; |
| 3304 | let app = get_application().await; |
| 3305 | let u = get_user().await; |
| 3306 | let service = Application::new(RequestValidator::new()); |
| 3307 | |
| 3308 | // create |
| 3309 | let create_req = get_request( |
| 3310 | &u.id, |
| 3311 | api::CreateBlynkIntegrationRequest { |
| 3312 | integration: Some(api::BlynkIntegration { |
| 3313 | application_id: app.id.to_string(), |
| 3314 | token: "foobartoken".into(), |
| 3315 | }), |
| 3316 | }, |
| 3317 | ); |
| 3318 | let _ = service.create_blynk_integration(create_req).await.unwrap(); |
| 3319 | |
| 3320 | // get |
| 3321 | let get_req = get_request( |
| 3322 | &u.id, |
| 3323 | api::GetBlynkIntegrationRequest { |
| 3324 | application_id: app.id.to_string(), |
| 3325 | }, |
| 3326 | ); |
| 3327 | let get_resp = service.get_blynk_integration(get_req).await.unwrap(); |
| 3328 | let get_resp = get_resp.get_ref(); |
| 3329 | assert_eq!( |
| 3330 | Some(api::BlynkIntegration { |
| 3331 | application_id: app.id.to_string(), |
| 3332 | token: "foobartoken".into(), |
| 3333 | }), |
| 3334 | get_resp.integration |
| 3335 | ); |
| 3336 | |
| 3337 | // update |
| 3338 | let update_req = get_request( |
| 3339 | &u.id, |
| 3340 | api::UpdateBlynkIntegrationRequest { |
| 3341 | integration: Some(api::BlynkIntegration { |
| 3342 | application_id: app.id.to_string(), |
| 3343 | token: "someothertoken".into(), |
| 3344 | }), |
| 3345 | }, |
| 3346 | ); |
| 3347 | let _ = service.update_blynk_integration(update_req).await.unwrap(); |
| 3348 | |
| 3349 | // get |
| 3350 | let get_req = get_request( |
| 3351 | &u.id, |
| 3352 | api::GetBlynkIntegrationRequest { |
| 3353 | application_id: app.id.to_string(), |
| 3354 | }, |
| 3355 | ); |
| 3356 | let get_resp = service.get_blynk_integration(get_req).await.unwrap(); |
| 3357 | let get_resp = get_resp.get_ref(); |
| 3358 | assert_eq!( |
| 3359 | Some(api::BlynkIntegration { |
nothing calls this directly
no test coverage detected