()
| 36 | |
| 37 | #[tokio::test] |
| 38 | async fn test_uplink() { |
| 39 | let _guard = test::prepare().await; |
| 40 | |
| 41 | let t = tenant::create(tenant::Tenant { |
| 42 | name: "tenant".into(), |
| 43 | can_have_gateways: true, |
| 44 | ..Default::default() |
| 45 | }) |
| 46 | .await |
| 47 | .unwrap(); |
| 48 | |
| 49 | let gw = gateway::create(gateway::Gateway { |
| 50 | name: "gateway".into(), |
| 51 | tenant_id: t.id, |
| 52 | gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]), |
| 53 | ..Default::default() |
| 54 | }) |
| 55 | .await |
| 56 | .unwrap(); |
| 57 | |
| 58 | let app = application::create(application::Application { |
| 59 | name: "app".into(), |
| 60 | tenant_id: t.id, |
| 61 | ..Default::default() |
| 62 | }) |
| 63 | .await |
| 64 | .unwrap(); |
| 65 | |
| 66 | let dp = device_profile::create(device_profile::DeviceProfile { |
| 67 | name: "dp".into(), |
| 68 | tenant_id: Some(t.id), |
| 69 | region: lrwn::region::CommonName::EU868, |
| 70 | mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4, |
| 71 | reg_params_revision: lrwn::region::Revision::RP002_1_0_3, |
| 72 | supports_otaa: true, |
| 73 | supports_class_b: true, |
| 74 | ..Default::default() |
| 75 | }) |
| 76 | .await |
| 77 | .unwrap(); |
| 78 | |
| 79 | let dev = device::create(device::Device { |
| 80 | name: "device".into(), |
| 81 | application_id: app.id, |
| 82 | device_profile_id: dp.id, |
| 83 | dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]), |
| 84 | enabled_class: DeviceClass::A, |
| 85 | dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])), |
| 86 | f_cnt_up: 8, |
| 87 | ..Default::default() |
| 88 | }) |
| 89 | .await |
| 90 | .unwrap(); |
| 91 | |
| 92 | let rx_info = gw::UplinkRxInfo { |
| 93 | gateway_id: gw.gateway_id.to_string(), |
| 94 | ..Default::default() |
| 95 | }; |
nothing calls this directly
no test coverage detected