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

Function test_device_list

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

Source from the content-addressed store, hash-verified

1181
1182 #[tokio::test]
1183 async fn test_device_list() {
1184 let _guard = test::prepare().await;
1185 let dp = storage::device_profile::test::create_device_profile(None).await;
1186 let d1 = create_device(
1187 EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
1188 dp.id.into(),
1189 None,
1190 )
1191 .await;
1192
1193 let d2 = create(Device {
1194 name: "zzz-tags-1".into(),
1195 dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
1196 tags: fields::KeyValue::new(
1197 [("version".to_string(), "1.1.0".to_string())]
1198 .iter()
1199 .cloned()
1200 .collect(),
1201 ),
1202 ..d1.clone()
1203 })
1204 .await
1205 .unwrap();
1206
1207 let d3 = create(Device {
1208 name: "zzz-tags-2".into(),
1209 dev_eui: EUI64::from_be_bytes([3, 2, 3, 4, 5, 6, 7, 8]),
1210 tags: fields::KeyValue::new(
1211 [("version".to_string(), "1.2.0".to_string())]
1212 .iter()
1213 .cloned()
1214 .collect(),
1215 ),
1216 ..d1.clone()
1217 })
1218 .await
1219 .unwrap();
1220
1221 // get count and list
1222 let tests = vec![
1223 FilterTest {
1224 name: "no filters".into(),
1225 filters: Filters {
1226 application_id: None,
1227 multicast_group_id: None,
1228 search: None,
1229 ..Default::default()
1230 },
1231 devs: vec![&d1, &d2, &d3],
1232 count: 3,
1233 limit: 10,
1234 offset: 0,
1235 order: OrderBy::Name,
1236 order_by_desc: false,
1237 },
1238 FilterTest {
1239 name: "filter by search - no match".into(),
1240 filters: Filters {

Callers

nothing calls this directly

Calls 10

prepareFunction · 0.85
create_device_profileFunction · 0.85
create_deviceFunction · 0.85
unwrapMethod · 0.80
iterMethod · 0.80
to_stringMethod · 0.80
createFunction · 0.70
get_countFunction · 0.70
listFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected