mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
updated tesst with system commands like send
This commit is contained in:
@@ -968,13 +968,35 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
|
|
||||||
if (single) {
|
if (single) {
|
||||||
// run dedicated tests only
|
// run dedicated tests only
|
||||||
// EMSESP::webCustomEntityService.test(); // custom entities
|
EMSESP::webCustomEntityService.test(); // custom entities
|
||||||
// EMSESP::webCustomizationService.test(); // set customizations - this will overwrite any settings in the FS
|
EMSESP::webCustomizationService.test(); // set customizations - this will overwrite any settings in the FS
|
||||||
// EMSESP::temperaturesensor_.test(); // add temperature sensors
|
EMSESP::temperaturesensor_.test(); // add temperature sensors
|
||||||
// EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
||||||
|
|
||||||
// request.url("/api/thermostat/commands");
|
request.method(HTTP_POST);
|
||||||
// EMSESP::webAPIService.webAPIService(&request);
|
|
||||||
|
char data[] = "{\"cmd\":\"send\",\"data\":\"0B 90 FF 13 01 01 B9 01\"}";
|
||||||
|
deserializeJson(doc, data);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api/system");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
char data2[] = "{\"device\":\"system\", \"cmd\":\"send\",\"value\":\"0B 90 FF 13 01 01 B9 02\"}";
|
||||||
|
deserializeJson(doc, data2);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
char data4[] = "{\"value\":\"0B 90 FF 13 01 01 B9 03\"}";
|
||||||
|
deserializeJson(doc, data4);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api/system/send");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
request.method(HTTP_GET);
|
||||||
|
|
||||||
|
request.url("/api/thermostat/commands");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request);
|
||||||
|
|
||||||
request.url("/api/thermostat/hc1/mode2");
|
request.url("/api/thermostat/hc1/mode2");
|
||||||
EMSESP::webAPIService.webAPIService(&request);
|
EMSESP::webAPIService.webAPIService(&request);
|
||||||
@@ -991,6 +1013,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
EMSESP::temperaturesensor_.test(); // add temperature sensors
|
EMSESP::temperaturesensor_.test(); // add temperature sensors
|
||||||
EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
||||||
|
|
||||||
|
request.method(HTTP_GET);
|
||||||
|
|
||||||
// boiler
|
// boiler
|
||||||
request.url("/api/boiler");
|
request.url("/api/boiler");
|
||||||
EMSESP::webAPIService.webAPIService(&request);
|
EMSESP::webAPIService.webAPIService(&request);
|
||||||
@@ -1049,6 +1073,32 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
request.url("/api/analogsensor/test_analog1/offset");
|
request.url("/api/analogsensor/test_analog1/offset");
|
||||||
EMSESP::webAPIService.webAPIService(&request);
|
EMSESP::webAPIService.webAPIService(&request);
|
||||||
|
|
||||||
|
// system calls with POST
|
||||||
|
request.method(HTTP_POST);
|
||||||
|
|
||||||
|
// these next 3 should return empty JSON in their response
|
||||||
|
char data[] = "{\"cmd\":\"send\",\"data\":\"0B 90 FF 13 01 01 B9 01\"}";
|
||||||
|
deserializeJson(doc, data);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api/system");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
char data2[] = "{\"device\":\"system\", \"cmd\":\"send\",\"value\":\"0B 90 FF 13 01 01 B9 02\"}";
|
||||||
|
deserializeJson(doc, data2);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
char data4[] = "{\"value\":\"0B 90 FF 13 01 01 B9 03\"}";
|
||||||
|
deserializeJson(doc, data4);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api/system/send");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
// console commands
|
||||||
|
shell.invoke_command("call system fetch");
|
||||||
|
shell.invoke_command("call system send \"0B 90 FF 13 01 01 B9\"");
|
||||||
|
|
||||||
//
|
//
|
||||||
// This next batch should all fail
|
// This next batch should all fail
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user