Expand description
Testing a plugin without the recorder: feed it messages, look at what it says back.
let dir = testing::temp_dir("my-plugin");
let hello = testing::hello(&dir, serde_json::json!({ "apiKey": "k" }));
let call = testing::call(&dir, "sys1", 101);
let out = testing::run::<MyPlugin>([HostMessage::Hello(hello), HostMessage::CallConcluded(call)]);
assert!(out.ready());
assert_eq!(out.results()[0].1, Outcome::Ok);Structs§
- Captured
- What a
capturehost was sent. - Mock
Server - A web server on 127.0.0.1 for testing a plugin that talks to one: it
answers every request with
respondand keeps them for you to look at. - Output
- What a plugin said, and how it ended.
- Request
- A request
MockServergot.
Functions§
- call
- A 3-second call on talkgroup
tgofshort_name(system 0), with its files written underdir: the JSON, a WAV of silence, and an “M4A” (placeholder bytes, not real audio) infiles.m4a. - capture
- A
Hostwhose messages are kept, for testing parts of a plugin (like acrate::CallQueue) on their own. - hello
- A hello with
configand one P25 system, “sys1” (index 0), with no settings of its own — setsystems[0].configfor those. Calls are underdir, and the plugin’s data folder isdir/data. Calls come as WAV and M4A; for a recorder without an M4A encoder, setaudio_formatsto["wav"]. - run
- Run
Ponmessages(a hello first) as the recorder would, then end its input — so itsPlugin::shutdownruns — and collect what it said. - temp_
dir - A fresh, empty folder for a test (under the system’s temp folder).