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

Function run_test

chirpstack/src/test/otaa_js_test.rs:340–387  ·  view source on GitHub ↗
(t: &Test)

Source from the content-addressed store, hash-verified

338}
339
340async fn run_test(t: &Test) {
341 println!("> {}", t.name);
342
343 reset_redis().await.unwrap();
344
345 let server = MockServer::start();
346 let mut js_mock = server.mock(|when, then| {
347 when.method(POST).path("/");
348
349 then.body(serde_json::to_string(&t.js_response).unwrap());
350 });
351
352 let mut conf: config::Configuration = (*config::get()).clone();
353 conf.join_server.servers = vec![config::JoinServerServer {
354 join_eui_prefix: EUI64Prefix::new([1, 2, 3, 4, 5, 6, 7, 8], 64),
355 server: server.url("/"),
356 ..Default::default()
357 }];
358 config::set(conf);
359 region::setup().unwrap();
360 joinserver::setup().await.unwrap();
361
362 integration::set_mock().await;
363 gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
364
365 integration::mock::reset().await;
366 gateway_backend::mock::reset().await;
367
368 uplink::handle_uplink(
369 CommonName::EU868,
370 "eu868",
371 Uuid::new_v4(),
372 gw::UplinkFrameSet {
373 phy_payload: t.phy_payload.to_vec().unwrap(),
374 tx_info: Some(t.tx_info.clone()),
375 rx_info: vec![t.rx_info.clone()],
376 },
377 )
378 .await
379 .unwrap();
380
381 js_mock.assert();
382 js_mock.delete();
383
384 for assert in &t.assert {
385 assert().await;
386 }
387}

Callers 1

test_jsFunction · 0.70

Calls 12

reset_redisFunction · 0.85
startFunction · 0.85
set_mockFunction · 0.85
set_backendFunction · 0.85
unwrapMethod · 0.80
getFunction · 0.50
setFunction · 0.50
setupFunction · 0.50
resetFunction · 0.50
handle_uplinkFunction · 0.50
to_vecMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected