()
| 938 | |
| 939 | #[tokio::test] |
| 940 | async fn test_device() { |
| 941 | let _guard = test::prepare().await; |
| 942 | |
| 943 | let t = tenant::create(tenant::Tenant { |
| 944 | name: "test-tenant".into(), |
| 945 | ..Default::default() |
| 946 | }) |
| 947 | .await |
| 948 | .unwrap(); |
| 949 | |
| 950 | let app = application::create(application::Application { |
| 951 | name: "test-app".into(), |
| 952 | tenant_id: t.id, |
| 953 | ..Default::default() |
| 954 | }) |
| 955 | .await |
| 956 | .unwrap(); |
| 957 | |
| 958 | let dp = device_profile::create(device_profile::DeviceProfile { |
| 959 | tenant_id: Some(t.id), |
| 960 | name: "test-dp".into(), |
| 961 | ..Default::default() |
| 962 | }) |
| 963 | .await |
| 964 | .unwrap(); |
| 965 | |
| 966 | let d = device::create(device::Device { |
| 967 | application_id: app.id, |
| 968 | device_profile_id: dp.id, |
| 969 | name: "test-device".into(), |
| 970 | dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]), |
| 971 | ..Default::default() |
| 972 | }) |
| 973 | .await |
| 974 | .unwrap(); |
| 975 | |
| 976 | let mg = create(MulticastGroup { |
| 977 | application_id: app.id, |
| 978 | name: "test-mg".into(), |
| 979 | region: CommonName::EU868, |
| 980 | mc_addr: DevAddr::from_be_bytes([1, 2, 3, 4]), |
| 981 | mc_nwk_s_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]), |
| 982 | f_cnt: 10, |
| 983 | group_type: "C".into(), |
| 984 | dr: 1, |
| 985 | frequency: 868100000, |
| 986 | class_b_ping_slot_periodicity: 1, |
| 987 | ..Default::default() |
| 988 | }) |
| 989 | .await |
| 990 | .unwrap(); |
| 991 | |
| 992 | // add device |
| 993 | add_device(&mg.id.into(), &d.dev_eui).await.unwrap(); |
| 994 | |
| 995 | // get group deveuis |
| 996 | let dev_euis = get_dev_euis(&mg.id.into()).await.unwrap(); |
| 997 | assert_eq!(vec![d.dev_eui], dev_euis); |
nothing calls this directly
no test coverage detected