()
| 2492 | |
| 2493 | #[tokio::test] |
| 2494 | async fn test_my_devices_integration() { |
| 2495 | let _guard = test::prepare().await; |
| 2496 | let app = get_application().await; |
| 2497 | let u = get_user().await; |
| 2498 | let service = Application::new(RequestValidator::new()); |
| 2499 | |
| 2500 | // create |
| 2501 | let create_req = get_request( |
| 2502 | &u.id, |
| 2503 | api::CreateMyDevicesIntegrationRequest { |
| 2504 | integration: Some(api::MyDevicesIntegration { |
| 2505 | application_id: app.id.to_string(), |
| 2506 | endpoint: "http://mydevices".into(), |
| 2507 | }), |
| 2508 | }, |
| 2509 | ); |
| 2510 | let _ = service |
| 2511 | .create_my_devices_integration(create_req) |
| 2512 | .await |
| 2513 | .unwrap(); |
| 2514 | |
| 2515 | // get |
| 2516 | let get_req = get_request( |
| 2517 | &u.id, |
| 2518 | api::GetMyDevicesIntegrationRequest { |
| 2519 | application_id: app.id.to_string(), |
| 2520 | }, |
| 2521 | ); |
| 2522 | let get_resp = service.get_my_devices_integration(get_req).await.unwrap(); |
| 2523 | let get_resp = get_resp.get_ref(); |
| 2524 | assert_eq!( |
| 2525 | Some(api::MyDevicesIntegration { |
| 2526 | application_id: app.id.to_string(), |
| 2527 | endpoint: "http://mydevices".into(), |
| 2528 | }), |
| 2529 | get_resp.integration |
| 2530 | ); |
| 2531 | |
| 2532 | // update |
| 2533 | let update_req = get_request( |
| 2534 | &u.id, |
| 2535 | api::UpdateMyDevicesIntegrationRequest { |
| 2536 | integration: Some(api::MyDevicesIntegration { |
| 2537 | application_id: app.id.to_string(), |
| 2538 | endpoint: "http://mydevices-updated".into(), |
| 2539 | }), |
| 2540 | }, |
| 2541 | ); |
| 2542 | let _ = service |
| 2543 | .update_my_devices_integration(update_req) |
| 2544 | .await |
| 2545 | .unwrap(); |
| 2546 | |
| 2547 | // get |
| 2548 | let get_req = get_request( |
| 2549 | &u.id, |
| 2550 | api::GetMyDevicesIntegrationRequest { |
| 2551 | application_id: app.id.to_string(), |
nothing calls this directly
no test coverage detected