kopia lustrzana https://github.com/weetmuts/wmbusmeters
Fix test.
rodzic
8a457d945b
commit
8030e8ed9c
|
@ -1,2 +1,2 @@
|
|||
telegram=|6644242381818181640E7246564656A51170071F0050052F2F|15257A616F14139172137DAE3A0C000000008C2013917213000B3B0000000B26784601025AF5000266EF00046D1B08B7214C1338861200CC101300000000CC201338861200426C9F2C42EC7EBF2C|
|
||||
telegram=|6644242381818181640E7246564656A51170071F0050052F2F_15257A616F14139172137DAE3A0C000000008C2013917213000B3B0000000B26784601025AF5000266EF00046D1B08B7214C1338861200CC101300000000CC201338861200426C9F2C42EC7EBF2C|
|
||||
{"media":"water","meter":"hydrus","name":"Vatten","id":"56465646","operating_time_h":14678,"meter_datetime":"2021-01-23 08:27","flow_temperature_c":24.5,"external_temperature_c":23.9,"status":"OK","total_tariff2_m3":137.291,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":128.638,"flow_m3h":0,"total_at_date_m3":128.638,"at_date":"2020-12-31","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
|
|
@ -9,19 +9,24 @@ TEST=testoutput
|
|||
TESTNAME="Test match on dll id"
|
||||
TESTRESULT="ERROR"
|
||||
|
||||
cat simulations/simulation_dll_tpl_diff.txt | grep '^{' > $TEST/test_expected.txt
|
||||
cat simulations/simulation_dll_tpl_diff.txt | grep '^{' | jq --sort-keys . > $TEST/test_expected.txt
|
||||
$PROG --format=json simulations/simulation_dll_tpl_diff.txt \
|
||||
Vatten hydrus 81818181 NOKEY \
|
||||
> $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
||||
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
|
||||
cat $TEST/test_output.txt | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
|
||||
diff $TEST/test_expected.txt $TEST/test_responses.txt
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo OK: $TESTNAME
|
||||
TESTRESULT="OK"
|
||||
else
|
||||
if [ "$USE_MELD" = "true" ]
|
||||
then
|
||||
meld $TEST/test_expected.txt $TEST/test_responses.txt
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "wmbusmeters returned error code: $?"
|
||||
|
@ -39,19 +44,24 @@ fi
|
|||
TESTNAME="Test match on tpl id"
|
||||
TESTRESULT="ERROR"
|
||||
|
||||
cat simulations/simulation_dll_tpl_diff.txt | grep '^{' > $TEST/test_expected.txt
|
||||
cat simulations/simulation_dll_tpl_diff.txt | grep '^{' | jq --sort-keys . > $TEST/test_expected.txt
|
||||
$PROG --format=json simulations/simulation_dll_tpl_diff.txt \
|
||||
Vatten hydrus 56465646 NOKEY \
|
||||
> $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
||||
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
|
||||
cat $TEST/test_output.txt | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
|
||||
diff $TEST/test_expected.txt $TEST/test_responses.txt
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo OK: $TESTNAME
|
||||
TESTRESULT="OK"
|
||||
else
|
||||
if [ "$USE_MELD" = "true" ]
|
||||
then
|
||||
meld $TEST/test_expected.txt $TEST/test_responses.txt
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "wmbusmeters returned error code: $?"
|
||||
|
|
Ładowanie…
Reference in New Issue