mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
update unit tests
This commit is contained in:
@@ -1,23 +1,14 @@
|
||||
// **************************************************************************************************
|
||||
//
|
||||
// Compile with -DEMSESP_UNITY_CREATE to generate the test functions, copy the output and paste below.
|
||||
//
|
||||
// TODO convert output to JSON and compare, showing differences
|
||||
//
|
||||
// You can also manually compare the differences using https://www.diffchecker.com/text-compare/
|
||||
//
|
||||
// **************************************************************************************************
|
||||
|
||||
// ---------- START - CUT HERE ----------
|
||||
|
||||
void test_1() {
|
||||
auto expected_response =
|
||||
"[{\"reset\":\"\",\"heatingoff\":\"off\",\"heatingactive\":\"off\",\"tapwateractive\":\"on\",\"selflowtemp\":0,\"curflowtemp\":60.2,\"rettemp\":48.1,"
|
||||
"\"syspress\":1.4,\"burngas\":\"on\",\"burngas2\":\"off\",\"flamecurr\":37.4,\"fanwork\":\"on\",\"ignwork\":\"off\",\"oilpreheat\":\"off\","
|
||||
"\"heatingpump\":\"on\",\"selburnpow\":115,\"curburnpow\":61,\"ubauptime\":3940268,\"servicecode\":\"=H\",\"servicecodenumber\":201,\"nompower\":0,"
|
||||
"\"nrgtotal\":0.0,\"nrgheat\":0.0,\"dhw\":{\"seltemp\":52,\"comfort\":\"hot\",\"flowtempoffset\":40,\"circpump\":\"off\",\"chargetype\":\"3-way "
|
||||
"valve\",\"hyston\":-5,\"hystoff\":0,\"disinfectiontemp\":70,\"circmode\":\"off\",\"circ\":\"off\",\"storagetemp1\":53.8,\"activated\":\"on\","
|
||||
"\"3wayvalve\":\"on\",\"nrg\":0.0}}]";
|
||||
auto expected_response = "[{\"reset\":\"\",\"heatingoff\":\"off\",\"heatingactive\":\"off\",\"tapwateractive\":\"on\",\"selflowtemp\":0,\"curflowtemp\":60."
|
||||
"2,\"rettemp\":48.1,\"syspress\":1.4,\"burngas\":\"on\",\"burngas2\":\"off\",\"flamecurr\":37.4,\"fanwork\":\"on\",\"ignwork\":"
|
||||
"\"off\",\"oilpreheat\":\"off\",\"heatingpump\":\"on\",\"selburnpow\":115,\"curburnpow\":61,\"ubauptime\":3940268,\"servicecode\":"
|
||||
"\"=H\",\"servicecodenumber\":201,\"nompower\":0,\"nrgtotal\":0.0,\"nrgheat\":0.0,\"dhw\":{\"seltemp\":52,\"comfort\":\"hot\","
|
||||
"\"flowtempoffset\":40,\"chargeoptimization\":\"off\",\"circpump\":\"off\",\"chargetype\":\"3-way "
|
||||
"valve\",\"hyston\":-5,\"disinfectiontemp\":70,\"circmode\":\"off\",\"circ\":\"off\",\"storagetemp1\":53.8,\"activated\":\"on\","
|
||||
"\"3wayvalve\":\"on\",\"chargepump\":\"off\",\"nrg\":0.0}}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler"));
|
||||
}
|
||||
|
||||
@@ -46,13 +37,13 @@ void test_2() {
|
||||
}
|
||||
|
||||
void test_3() {
|
||||
auto expected_response =
|
||||
"[{\"reset\":\"\",\"heatingoff\":\"off\",\"heatingactive\":\"off\",\"tapwateractive\":\"on\",\"selflowtemp\":0,\"curflowtemp\":60.2,\"rettemp\":48.1,"
|
||||
"\"syspress\":1.4,\"burngas\":\"on\",\"burngas2\":\"off\",\"flamecurr\":37.4,\"fanwork\":\"on\",\"ignwork\":\"off\",\"oilpreheat\":\"off\","
|
||||
"\"heatingpump\":\"on\",\"selburnpow\":115,\"curburnpow\":61,\"ubauptime\":3940268,\"servicecode\":\"=H\",\"servicecodenumber\":201,\"nompower\":0,"
|
||||
"\"nrgtotal\":0.0,\"nrgheat\":0.0,\"dhw\":{\"seltemp\":52,\"comfort\":\"hot\",\"flowtempoffset\":40,\"circpump\":\"off\",\"chargetype\":\"3-way "
|
||||
"valve\",\"hyston\":-5,\"hystoff\":0,\"disinfectiontemp\":70,\"circmode\":\"off\",\"circ\":\"off\",\"storagetemp1\":53.8,\"activated\":\"on\","
|
||||
"\"3wayvalve\":\"on\",\"nrg\":0.0}}]";
|
||||
auto expected_response = "[{\"reset\":\"\",\"heatingoff\":\"off\",\"heatingactive\":\"off\",\"tapwateractive\":\"on\",\"selflowtemp\":0,\"curflowtemp\":60."
|
||||
"2,\"rettemp\":48.1,\"syspress\":1.4,\"burngas\":\"on\",\"burngas2\":\"off\",\"flamecurr\":37.4,\"fanwork\":\"on\",\"ignwork\":"
|
||||
"\"off\",\"oilpreheat\":\"off\",\"heatingpump\":\"on\",\"selburnpow\":115,\"curburnpow\":61,\"ubauptime\":3940268,\"servicecode\":"
|
||||
"\"=H\",\"servicecodenumber\":201,\"nompower\":0,\"nrgtotal\":0.0,\"nrgheat\":0.0,\"dhw\":{\"seltemp\":52,\"comfort\":\"hot\","
|
||||
"\"flowtempoffset\":40,\"chargeoptimization\":\"off\",\"circpump\":\"off\",\"chargetype\":\"3-way "
|
||||
"valve\",\"hyston\":-5,\"disinfectiontemp\":70,\"circmode\":\"off\",\"circ\":\"off\",\"storagetemp1\":53.8,\"activated\":\"on\","
|
||||
"\"3wayvalve\":\"on\",\"chargepump\":\"off\",\"nrg\":0.0}}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/values"));
|
||||
}
|
||||
|
||||
@@ -64,11 +55,12 @@ void test_4() {
|
||||
"(flamecurr)\":37.4,\"fan (fanwork)\":\"on\",\"ignition (ignwork)\":\"off\",\"oil preheating (oilpreheat)\":\"off\",\"heating pump "
|
||||
"(heatingpump)\":\"on\",\"burner selected max power (selburnpow)\":115,\"burner current power (curburnpow)\":61,\"total UBA operating time "
|
||||
"(ubauptime)\":\"2736 days 7 hours 8 minutes\",\"service code (servicecode)\":\"=H\",\"service code number (servicecodenumber)\":201,\"dhw selected "
|
||||
"temperature (seltemp)\":52,\"dhw comfort (comfort)\":\"hot\",\"dhw flow temperature offset (flowtempoffset)\":40,\"dhw circulation pump available "
|
||||
"(circpump)\":\"off\",\"dhw charging type (chargetype)\":\"3-way valve\",\"dhw hysteresis on temperature (hyston)\":-5,\"dhw hysteresis off "
|
||||
"temperature (hystoff)\":0,\"dhw disinfection temperature (disinfectiontemp)\":70,\"dhw circulation pump mode (circmode)\":\"off\",\"dhw circulation "
|
||||
"active (circ)\":\"off\",\"dhw storage intern temperature (storagetemp1)\":53.8,\"dhw activated (activated)\":\"on\",\"dhw 3-way valve active "
|
||||
"(3wayvalve)\":\"on\",\"nominal Power (nompower)\":0,\"total energy (nrgtotal)\":0.0,\"energy heating (nrgheat)\":0.0,\"dhw energy (nrg)\":0.0}]";
|
||||
"temperature (seltemp)\":52,\"dhw comfort (comfort)\":\"hot\",\"dhw flow temperature offset (flowtempoffset)\":40,\"dhw charge optimization "
|
||||
"(chargeoptimization)\":\"off\",\"dhw circulation pump available (circpump)\":\"off\",\"dhw charging type (chargetype)\":\"3-way valve\",\"dhw "
|
||||
"hysteresis on temperature (hyston)\":-5,\"dhw disinfection temperature (disinfectiontemp)\":70,\"dhw circulation pump mode (circmode)\":\"off\",\"dhw "
|
||||
"circulation active (circ)\":\"off\",\"dhw storage intern temperature (storagetemp1)\":53.8,\"dhw activated (activated)\":\"on\",\"dhw 3-way valve "
|
||||
"active (3wayvalve)\":\"on\",\"dhw charge pump (chargepump)\":\"off\",\"nominal Power (nompower)\":0,\"total energy (nrgtotal)\":0.0,\"energy heating "
|
||||
"(nrgheat)\":0.0,\"dhw energy (nrg)\":0.0}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/info"));
|
||||
}
|
||||
|
||||
@@ -93,7 +85,6 @@ void test_8() {
|
||||
auto expected_response = "[{\"name\":\"outdoortemp\",\"fullname\":\"outside "
|
||||
"temperature\",\"circuit\":\"\",\"type\":\"number\",\"uom\":\"°C\",\"state_class\":\"measurement\",\"device_class\":"
|
||||
"\"temperature\",\"readable\":true,\"writeable\":false,\"visible\":true}]";
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/outdoortemp"));
|
||||
}
|
||||
|
||||
@@ -140,22 +131,34 @@ void test_15() {
|
||||
}
|
||||
|
||||
void test_16() {
|
||||
auto expected_response = "[{\"test_custom\":0.00,\"test_read_only\":0.00,\"test_ram\":\"14\",\"seltemp\":\"14\"}]";
|
||||
auto expected_response = "[{\"test_custom\":0.00,\"test_read_only\":70.00,\"test_ram\":\"14\",\"test_seltemp\":\"14\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom"));
|
||||
}
|
||||
|
||||
void test_17() {
|
||||
auto expected_response = "[{\"test_custom\":0.00,\"test_read_only\":0.00,\"test_ram\":\"14\",\"seltemp\":\"14\"}]";
|
||||
auto expected_response = "[{\"test_custom\":0.00,\"test_read_only\":70.00,\"test_ram\":\"14\",\"test_seltemp\":\"14\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/info"));
|
||||
}
|
||||
|
||||
void test_18() {
|
||||
auto expected_response = "[{\"name\":\"seltemp\",\"fullname\":\"seltemp\",\"storage\":\"ram\",\"type\":\"number\",\"readable\":true,\"writeable\":true,"
|
||||
"\"visible\":true,\"value\":\"14\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/seltemp"));
|
||||
auto expected_response = "[{\"name\":\"test_seltemp\",\"fullname\":\"test_seltemp\",\"storage\":\"ram\",\"type\":\"number\",\"readable\":true,"
|
||||
"\"writeable\":true,\"visible\":true,\"ent_cat\":\"diagnostic\",\"value\":\"14\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/test_seltemp"));
|
||||
}
|
||||
|
||||
void test_19() {
|
||||
auto expected_response = "[{\"api_data\":\"14\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/test_seltemp/value"));
|
||||
}
|
||||
|
||||
void test_20() {
|
||||
auto expected_response = "[{\"name\":\"test_custom\",\"fullname\":\"test_custom\",\"storage\":\"ems\",\"type\":\"number\",\"readable\":true,\"writeable\":"
|
||||
"true,\"visible\":true,\"device_id\":\"0x08\",\"type_id\":\"0x18\",\"offset\":0,\"factor\":1,\"ent_cat\":\"diagnostic\",\"uom\":"
|
||||
"\"°C\",\"state_class\":\"measurement\",\"device_class\":\"temperature\",\"value\":0.00}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/test_custom"));
|
||||
}
|
||||
|
||||
void test_21() {
|
||||
auto expected_response =
|
||||
"[{\"system\":{\"version\":\"dev\",\"uptime\":\"000+00:00:00.000\",\"uptimeSec\":0,\"resetReason\":\"Unknown / "
|
||||
"Unknown\"},\"network\":{\"network\":\"WiFi\",\"hostname\":\"ems-esp\",\"RSSI\":-23,\"TxPowerSetting\":0,\"staticIP\":false,\"lowBandwidth\":false,"
|
||||
@@ -170,10 +173,10 @@ void test_19() {
|
||||
"\"busRxLineQuality\":100,\"busTxLineQuality\":100},\"settings\":{\"boardProfile\":\"S32\",\"locale\":\"en\",\"txMode\":8,\"emsBusID\":11,"
|
||||
"\"showerTimer\":false,\"showerMinDuration\":180,\"showerAlert\":false,\"hideLed\":false,\"noTokenApi\":false,\"readonlyMode\":false,\"fahrenheit\":"
|
||||
"false,\"dallasParasite\":false,\"boolFormat\":1,\"boolDashboard\":1,\"enumFormat\":1,\"analogEnabled\":true,\"telnetEnabled\":true,"
|
||||
"\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":"
|
||||
"\"boiler\",\"name\":\"My Custom "
|
||||
"Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":37,\"handlersReceived\":\"0x18\","
|
||||
"\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E "
|
||||
"\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":\"boiler\",\"name\":\"My "
|
||||
"Custom "
|
||||
"Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":38,\"handlersReceived\":\"0x18\","
|
||||
"\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0xC6 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E "
|
||||
"0x3B\"},{\"type\":\"thermostat\",\"name\":\"FW120\",\"deviceID\":\"0x10\",\"productID\":192,\"brand\":\"\",\"version\":\"01.00\",\"entities\":15,"
|
||||
"\"handlersReceived\":\"0x016F\",\"handlersFetched\":\"0x0170 0x0171\",\"handlersPending\":\"0xA3 0x06 0xA2 0x12 0x13 0x0172 0x0165 "
|
||||
"0x0168\"},{\"type\":\"temperaturesensor\",\"name\":\"temperaturesensor\",\"entities\":2},{\"type\":\"analogsensor\",\"name\":\"analogsensor\","
|
||||
@@ -181,7 +184,7 @@ void test_19() {
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system"));
|
||||
}
|
||||
|
||||
void test_20() {
|
||||
void test_22() {
|
||||
auto expected_response =
|
||||
"[{\"system\":{\"version\":\"dev\",\"uptime\":\"000+00:00:00.000\",\"uptimeSec\":0,\"resetReason\":\"Unknown / "
|
||||
"Unknown\"},\"network\":{\"network\":\"WiFi\",\"hostname\":\"ems-esp\",\"RSSI\":-23,\"TxPowerSetting\":0,\"staticIP\":false,\"lowBandwidth\":false,"
|
||||
@@ -196,10 +199,10 @@ void test_20() {
|
||||
"\"busRxLineQuality\":100,\"busTxLineQuality\":100},\"settings\":{\"boardProfile\":\"S32\",\"locale\":\"en\",\"txMode\":8,\"emsBusID\":11,"
|
||||
"\"showerTimer\":false,\"showerMinDuration\":180,\"showerAlert\":false,\"hideLed\":false,\"noTokenApi\":false,\"readonlyMode\":false,\"fahrenheit\":"
|
||||
"false,\"dallasParasite\":false,\"boolFormat\":1,\"boolDashboard\":1,\"enumFormat\":1,\"analogEnabled\":true,\"telnetEnabled\":true,"
|
||||
"\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":"
|
||||
"\"boiler\",\"name\":\"My Custom "
|
||||
"Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":37,\"handlersReceived\":\"0x18\","
|
||||
"\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E "
|
||||
"\"maxWebLogBuffer\":25,\"modbusEnabled\":false,\"forceHeatingOff\":false,\"developerMode\":false},\"devices\":[{\"type\":\"boiler\",\"name\":\"My "
|
||||
"Custom "
|
||||
"Boiler\",\"deviceID\":\"0x08\",\"productID\":123,\"brand\":\"\",\"version\":\"01.00\",\"entities\":38,\"handlersReceived\":\"0x18\","
|
||||
"\"handlersFetched\":\"0x14 0x33\",\"handlersPending\":\"0xBF 0x10 0x11 0xC2 0xC6 0x15 0x1C 0x19 0x1A 0x35 0x34 0x2A 0xD1 0xE3 0xE4 0xE5 0xE9 0x2E "
|
||||
"0x3B\"},{\"type\":\"thermostat\",\"name\":\"FW120\",\"deviceID\":\"0x10\",\"productID\":192,\"brand\":\"\",\"version\":\"01.00\",\"entities\":15,"
|
||||
"\"handlersReceived\":\"0x016F\",\"handlersFetched\":\"0x0170 0x0171\",\"handlersPending\":\"0xA3 0x06 0xA2 0x12 0x13 0x0172 0x0165 "
|
||||
"0x0168\"},{\"type\":\"temperaturesensor\",\"name\":\"temperaturesensor\",\"entities\":2},{\"type\":\"analogsensor\",\"name\":\"analogsensor\","
|
||||
@@ -207,168 +210,168 @@ void test_20() {
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/info"));
|
||||
}
|
||||
|
||||
void test_21() {
|
||||
void test_23() {
|
||||
auto expected_response =
|
||||
"[{\"name\":\"locale\",\"circuit\":\"settings\",\"readable\":true,\"writeable\":false,\"visible\":true,\"value\":\"en\",\"type\":\"string\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/settings/locale"));
|
||||
}
|
||||
|
||||
void test_22() {
|
||||
void test_24() {
|
||||
auto expected_response = "[{}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/fetch"));
|
||||
}
|
||||
|
||||
void test_23() {
|
||||
void test_25() {
|
||||
auto expected_response = "[{\"network\":\"WiFi\",\"hostname\":\"ems-esp\",\"RSSI\":\"-23\",\"TxPowerSetting\":\"0\",\"staticIP\":\"false\","
|
||||
"\"lowBandwidth\":\"false\",\"disableSleep\":\"true\",\"enableMDNS\":\"true\",\"enableCORS\":\"false\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("api/system/network/values"));
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/network/values"));
|
||||
}
|
||||
|
||||
void test_24() {
|
||||
void test_26() {
|
||||
auto expected_response = "[{\"test_scheduler\":\"on\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler"));
|
||||
}
|
||||
|
||||
void test_25() {
|
||||
void test_27() {
|
||||
auto expected_response = "[{\"test_scheduler\":\"on\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler/info"));
|
||||
}
|
||||
|
||||
void test_26() {
|
||||
void test_28() {
|
||||
auto expected_response = "[{\"name\":\"test_scheduler\",\"fullname\":\"test_scheduler\",\"type\":\"boolean\",\"value\":\"on\",\"time\":\"12:00\","
|
||||
"\"command\":\"system/fetch\",\"cmd_data\":\"10\",\"readable\":true,\"writeable\":true,\"visible\":true}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler/test_scheduler"));
|
||||
}
|
||||
|
||||
void test_27() {
|
||||
void test_29() {
|
||||
auto expected_response = "[{\"test_tempsensor1\":12.3,\"test_tempsensor2\":45.6}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor"));
|
||||
}
|
||||
|
||||
void test_28() {
|
||||
void test_30() {
|
||||
auto expected_response = "[{\"test_tempsensor1\":12.3,\"test_tempsensor2\":45.6}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/info"));
|
||||
}
|
||||
|
||||
void test_29() {
|
||||
void test_31() {
|
||||
auto expected_response = "[{\"id\":\"0B_0C0D_0E0F_1011\",\"name\":\"test_tempsensor2\",\"fullname\":\"test_tempsensor2\",\"value\":45.6,\"type\":"
|
||||
"\"number\",\"uom\":\"°C\",\"readable\":true,\"writeable\":false,\"visible\":true}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/test_tempsensor2"));
|
||||
}
|
||||
|
||||
void test_30() {
|
||||
void test_32() {
|
||||
auto expected_response = "[{\"id\":\"0B_0C0D_0E0F_1011\",\"name\":\"test_tempsensor2\",\"fullname\":\"test_tempsensor2\",\"value\":45.6,\"type\":"
|
||||
"\"number\",\"uom\":\"°C\",\"readable\":true,\"writeable\":false,\"visible\":true}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/0B_0C0D_0E0F_1011"));
|
||||
}
|
||||
|
||||
void test_31() {
|
||||
void test_33() {
|
||||
auto expected_response = "[{\"api_data\":\"45.6\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/test_tempsensor2/value"));
|
||||
}
|
||||
|
||||
void test_32() {
|
||||
void test_34() {
|
||||
auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0,\"test_analogsensor4\":0}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor"));
|
||||
}
|
||||
|
||||
void test_33() {
|
||||
void test_35() {
|
||||
auto expected_response = "[{\"test_analogsensor1\":0,\"test_analogsensor2\":1,\"test_analogsensor3\":0,\"test_analogsensor4\":0}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/info"));
|
||||
}
|
||||
|
||||
void test_34() {
|
||||
void test_36() {
|
||||
auto expected_response = "[{\"name\":\"test_analogsensor1\",\"fullname\":\"test_analogsensor1\",\"gpio\":36,\"type\":\"number\",\"analog\":\"adc\","
|
||||
"\"value\":0,\"readable\":true,\"writeable\":false,\"visible\":true,\"offset\":0,\"factor\":0.1,\"uom\":\"mV\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analogsensor1"));
|
||||
}
|
||||
|
||||
void test_35() {
|
||||
void test_37() {
|
||||
auto expected_response = "[{\"api_data\":\"0\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analogsensor1/offset"));
|
||||
}
|
||||
|
||||
void test_36() {
|
||||
void test_38() {
|
||||
auto expected_response = "[{\"message\":\"unknown device boiler2\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler2"));
|
||||
}
|
||||
|
||||
void test_37() {
|
||||
void test_39() {
|
||||
auto expected_response = "[{}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/bad/value"));
|
||||
}
|
||||
|
||||
void test_38() {
|
||||
void test_40() {
|
||||
auto expected_response = "[{\"message\":\"no attribute 'valu' in comfort\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/boiler/comfort/valu"));
|
||||
}
|
||||
|
||||
void test_39() {
|
||||
void test_41() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'settings' in system\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/settings/locale2"));
|
||||
}
|
||||
|
||||
void test_40() {
|
||||
void test_42() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'settings2' in system\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/settings2"));
|
||||
}
|
||||
|
||||
void test_41() {
|
||||
void test_43() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'settings2' in system\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/system/settings2/locale2"));
|
||||
}
|
||||
|
||||
void test_42() {
|
||||
void test_44() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_scheduler2' in scheduler\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler/test_scheduler2"));
|
||||
}
|
||||
|
||||
void test_43() {
|
||||
void test_45() {
|
||||
auto expected_response = "[{\"message\":\"no attribute 'val' in test_scheduler\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler/test_scheduler/val"));
|
||||
}
|
||||
|
||||
void test_44() {
|
||||
void test_46() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_scheduler2' in scheduler\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/scheduler/test_scheduler2/val2"));
|
||||
}
|
||||
|
||||
void test_45() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'seltemp2' in custom\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/seltemp2"));
|
||||
}
|
||||
|
||||
void test_46() {
|
||||
auto expected_response = "[{\"message\":\"no attribute 'val' in seltemp\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/seltemp/val"));
|
||||
}
|
||||
|
||||
void test_47() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_seltemp2' in custom\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/test_seltemp2"));
|
||||
}
|
||||
|
||||
void test_48() {
|
||||
auto expected_response = "[{\"message\":\"Command test_seltemp failed (Error)\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/custom/test_seltemp/val"));
|
||||
}
|
||||
|
||||
void test_49() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_sensor20' in temperaturesensor\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/test_sensor20"));
|
||||
}
|
||||
|
||||
void test_48() {
|
||||
void test_50() {
|
||||
auto expected_response = "[{\"message\":\"no entity '0b_0c0d_0e0f_xxxx' in temperaturesensor\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/0B_0C0D_0E0F_XXXX"));
|
||||
}
|
||||
|
||||
void test_49() {
|
||||
void test_51() {
|
||||
auto expected_response = "[{\"message\":\"no attribute 'bad' in test_tempsensor2\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/temperaturesensor/test_tempsensor2/bad"));
|
||||
}
|
||||
|
||||
void test_50() {
|
||||
void test_52() {
|
||||
auto expected_response = "[{\"message\":\"no attribute 'bad' in test_analogsensor1\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analogsensor1/bad"));
|
||||
}
|
||||
|
||||
void test_51() {
|
||||
void test_53() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_analog10' in analogsensor\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analog10"));
|
||||
}
|
||||
|
||||
void test_52() {
|
||||
void test_54() {
|
||||
auto expected_response = "[{\"message\":\"no entity 'test_analog10' in analogsensor\"}]";
|
||||
TEST_ASSERT_EQUAL_STRING(expected_response, call_url("/api/analogsensor/test_analog10/bad2"));
|
||||
}
|
||||
@@ -426,6 +429,8 @@ void run_tests() {
|
||||
RUN_TEST(test_50);
|
||||
RUN_TEST(test_51);
|
||||
RUN_TEST(test_52);
|
||||
RUN_TEST(test_53);
|
||||
RUN_TEST(test_54);
|
||||
}
|
||||
|
||||
// ---------- END - CUT HERE ----------
|
||||
// ---------- END - CUT HERE ----------
|
||||
Reference in New Issue
Block a user