2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-05 18:16:44 +00:00
fhem-mirror/fhem/t/00_MQTT2_SERVER/01_autocreate.t
2020-05-13 10:27:43 +00:00

26 lines
612 B
Perl

# More complex test, with external program and delayed log/event checking
# Note: exit(0) must be called in the delayed code.
use strict;
use warnings;
use Test::More;
my $usage = `mosquitto_pub 2>&1`;
if(!$usage) { # mosquitto not installed
ok(1);
done_testing;
exit(0);
}
fhem('"mosquitto_pub -i test -t hallo -m world"');
InternalTimer(time()+1, sub() {
is(FhemTestUtils_gotLog(
"autocreate: define MQTT2_test MQTT2_DEVICE test m2s"), 1,
"autocreate log");
is(FhemTestUtils_gotEvent("MQTT2_test:hallo: world"), 1,
"autocreate event");
done_testing;
exit(0);
}, 0);
1;