MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_device

Function test_device

chirpstack/src/storage/device.rs:1157–1180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1155
1156 #[tokio::test]
1157 async fn test_device() {
1158 let _guard = test::prepare().await;
1159 let dp = storage::device_profile::test::create_device_profile(None).await;
1160 let mut d = create_device(
1161 EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
1162 dp.id.into(),
1163 None,
1164 )
1165 .await;
1166
1167 // get
1168 let d_get = get(&d.dev_eui).await.unwrap();
1169 assert_eq!(d, d_get);
1170
1171 // update
1172 d.name = "updated".into();
1173 d = update(d).await.unwrap();
1174 let d_get = get(&d.dev_eui).await.unwrap();
1175 assert_eq!(d, d_get);
1176
1177 // delete
1178 delete(&d.dev_eui).await.unwrap();
1179 assert!(delete(&d.dev_eui).await.is_err());
1180 }
1181
1182 #[tokio::test]
1183 async fn test_device_list() {

Callers

nothing calls this directly

Calls 8

prepareFunction · 0.85
create_device_profileFunction · 0.85
create_deviceFunction · 0.85
unwrapMethod · 0.80
getFunction · 0.70
updateFunction · 0.70
deleteFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected