()
| 14 | |
| 15 | #[tokio::test] |
| 16 | async fn test_class_b() { |
| 17 | let _guard = test::prepare().await; |
| 18 | |
| 19 | let t = tenant::create(tenant::Tenant { |
| 20 | name: "tenant".into(), |
| 21 | can_have_gateways: true, |
| 22 | ..Default::default() |
| 23 | }) |
| 24 | .await |
| 25 | .unwrap(); |
| 26 | |
| 27 | let app = application::create(application::Application { |
| 28 | name: "app".into(), |
| 29 | tenant_id: t.id, |
| 30 | ..Default::default() |
| 31 | }) |
| 32 | .await |
| 33 | .unwrap(); |
| 34 | |
| 35 | let dp = device_profile::create(device_profile::DeviceProfile { |
| 36 | name: "class-b".into(), |
| 37 | tenant_id: Some(t.id), |
| 38 | region: lrwn::region::CommonName::EU868, |
| 39 | mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4, |
| 40 | reg_params_revision: lrwn::region::Revision::RP002_1_0_3, |
| 41 | supports_otaa: true, |
| 42 | class_b_params: Some(fields::ClassBParams { |
| 43 | timeout: 60, |
| 44 | ping_slot_periodicity: 1, |
| 45 | ping_slot_dr: 0, |
| 46 | ping_slot_freq: 868100000, |
| 47 | ..Default::default() |
| 48 | }), |
| 49 | ..Default::default() |
| 50 | }) |
| 51 | .await |
| 52 | .unwrap(); |
| 53 | |
| 54 | let dev = device::create(device::Device { |
| 55 | dev_eui: EUI64::from_str("0102030405060708").unwrap(), |
| 56 | application_id: app.id, |
| 57 | device_profile_id: dp.id, |
| 58 | name: "test-dev".into(), |
| 59 | enabled_class: device::DeviceClass::B, |
| 60 | device_session: Some(fields::DeviceSession::new(Default::default())), |
| 61 | ..Default::default() |
| 62 | }) |
| 63 | .await |
| 64 | .unwrap(); |
| 65 | |
| 66 | let qi = device_queue::enqueue_item(device_queue::DeviceQueueItem { |
| 67 | f_port: 10, |
| 68 | data: vec![0x01, 0x02, 0x03], |
| 69 | dev_eui: dev.dev_eui, |
| 70 | confirmed: true, |
| 71 | f_cnt_down: Some(10), |
| 72 | ..Default::default() |
| 73 | }) |
nothing calls this directly
no test coverage detected