| 168 | } |
| 169 | |
| 170 | pub async fn create_device_keys(dev_eui: Option<EUI64>) -> DeviceKeys { |
| 171 | let dev_eui = match dev_eui { |
| 172 | Some(v) => v, |
| 173 | None => { |
| 174 | let dp = storage::device_profile::test::create_device_profile(None).await; |
| 175 | let a = storage::application::test::create_application(None).await; |
| 176 | let d = storage::device::Device { |
| 177 | name: "test-dev".into(), |
| 178 | dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]), |
| 179 | application_id: a.id, |
| 180 | device_profile_id: dp.id, |
| 181 | ..Default::default() |
| 182 | }; |
| 183 | |
| 184 | let d = storage::device::create(d).await.unwrap(); |
| 185 | d.dev_eui |
| 186 | } |
| 187 | }; |
| 188 | |
| 189 | let dk = DeviceKeys { |
| 190 | dev_eui, |
| 191 | ..Default::default() |
| 192 | }; |
| 193 | |
| 194 | create(dk).await.unwrap() |
| 195 | } |
| 196 | |
| 197 | #[tokio::test] |
| 198 | async fn test_device_keys() { |