()
| 15 | |
| 16 | #[tokio::test] |
| 17 | async fn test_multicast() { |
| 18 | let _guard = test::prepare().await; |
| 19 | |
| 20 | // tenant |
| 21 | let t = tenant::create(tenant::Tenant { |
| 22 | name: "test-tenant".into(), |
| 23 | can_have_gateways: true, |
| 24 | ..Default::default() |
| 25 | }) |
| 26 | .await |
| 27 | .unwrap(); |
| 28 | |
| 29 | // gateway |
| 30 | let gw = gateway::create(gateway::Gateway { |
| 31 | tenant_id: t.id, |
| 32 | gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]), |
| 33 | name: "test-gw".into(), |
| 34 | properties: fields::KeyValue::new( |
| 35 | [("region_config_id".to_string(), "eu868".to_string())] |
| 36 | .iter() |
| 37 | .cloned() |
| 38 | .collect(), |
| 39 | ), |
| 40 | stats_interval_secs: 30, |
| 41 | last_seen_at: Some(Utc::now()), |
| 42 | ..Default::default() |
| 43 | }) |
| 44 | .await |
| 45 | .unwrap(); |
| 46 | |
| 47 | // application |
| 48 | let app = application::create(application::Application { |
| 49 | name: "test-app".into(), |
| 50 | tenant_id: t.id, |
| 51 | ..Default::default() |
| 52 | }) |
| 53 | .await |
| 54 | .unwrap(); |
| 55 | |
| 56 | // device-profile |
| 57 | let dp = device_profile::create(device_profile::DeviceProfile { |
| 58 | name: "test-dp".into(), |
| 59 | tenant_id: Some(t.id), |
| 60 | ..Default::default() |
| 61 | }) |
| 62 | .await |
| 63 | .unwrap(); |
| 64 | |
| 65 | // device |
| 66 | let d = device::create(device::Device { |
| 67 | name: "test-dev".into(), |
| 68 | application_id: app.id, |
| 69 | device_profile_id: dp.id, |
| 70 | dev_eui: EUI64::from_be_bytes([8, 7, 6, 5, 4, 3, 2, 1]), |
| 71 | device_session: Some(fields::DeviceSession::new(internal::DeviceSession { |
| 72 | gateway_rx_info_history: vec![internal::GatewayRxInfoHistory { |
| 73 | items: vec![internal::GatewayRxInfoHistoryItem { |
| 74 | gateway_id: gw.gateway_id.to_vec(), |
nothing calls this directly
no test coverage detected