From 98fb970dac3a52a7712eeb327501a72344cc095f Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 6 Jun 2022 11:19:56 +0200 Subject: [PATCH] add test for #541 --- src/test/test.cpp | 19 +++++++++++++++++++ src/test/test.h | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/test/test.cpp b/src/test/test.cpp index de793b39a..7410cd07f 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -692,6 +692,25 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const EMSESP::mqtt_.incoming("ems-esp/boiler/wwseltemp", "59"); } + // https://github.com/emsesp/EMS-ESP32/issues/541 + if (command == "api_wwmode") { + shell.printfln(F("Testing API wwmode")); + Mqtt::ha_enabled(false); + Mqtt::nested_format(1); + run_test("310"); + + AsyncWebServerRequest request; + request.method(HTTP_POST); + DynamicJsonDocument doc(2000); + JsonVariant json; + + char data[] = "{\"value\":\"off\"}"; + deserializeJson(doc, data); + json = doc.as(); + request.url("/api/thermostat/wwmode"); + EMSESP::webAPIService.webAPIService_post(&request, json); + } + if (command == "api") { shell.printfln(F("Testing API with MQTT and REST, standalone")); diff --git a/src/test/test.h b/src/test/test.h index be3bf9cb1..30bc6f307 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -48,8 +48,9 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "2thermostats" // #define EMSESP_DEBUG_DEFAULT "dallas" // #define EMSESP_DEBUG_DEFAULT "analog" -#define EMSESP_DEBUG_DEFAULT "api_values" +// #define EMSESP_DEBUG_DEFAULT "api_values" // #define EMSESP_DEBUG_DEFAULT "mqtt_post" +#define EMSESP_DEBUG_DEFAULT "api_wwmode" class Test { public: