| 689 | } |
| 690 | |
| 691 | pub async fn create_device_profile(tenant_id: Option<Uuid>) -> DeviceProfile { |
| 692 | let tenant_id = match tenant_id { |
| 693 | Some(v) => v.into(), |
| 694 | None => { |
| 695 | let t = storage::tenant::test::create_tenant().await; |
| 696 | t.id |
| 697 | } |
| 698 | }; |
| 699 | |
| 700 | let mut kv = HashMap::new(); |
| 701 | kv.insert("foo".into(), "bar".into()); |
| 702 | |
| 703 | let dp = DeviceProfile { |
| 704 | tenant_id: Some(tenant_id), |
| 705 | name: "test device-profile".into(), |
| 706 | region: CommonName::EU868, |
| 707 | mac_version: MacVersion::LORAWAN_1_0_2, |
| 708 | reg_params_revision: Revision::B, |
| 709 | adr_algorithm_id: "default".into(), |
| 710 | payload_codec_runtime: Codec::JS, |
| 711 | uplink_interval: 60, |
| 712 | supports_otaa: true, |
| 713 | tags: fields::KeyValue::new(kv), |
| 714 | ..Default::default() |
| 715 | }; |
| 716 | |
| 717 | create(dp).await.unwrap() |
| 718 | } |
| 719 | |
| 720 | #[tokio::test] |
| 721 | async fn test_device_profile() { |