Skip to content

Commit

Permalink
Update unity tests + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Slider0007 committed Oct 20, 2024
1 parent e3c591b commit fe6efdf
Show file tree
Hide file tree
Showing 20 changed files with 144 additions and 56 deletions.
2 changes: 1 addition & 1 deletion code/components/config_handling/configClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ esp_err_t ConfigClass::parseConfig(httpd_req_t *req, bool init, bool unityTest)

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "influxdbv2"), "authmode");
if (cJSON_IsNumber(objEl))
cfgDataTemp.sectionInfluxDBv2.authMode = std::clamp(objEl->valueint, 0, 2);
cfgDataTemp.sectionInfluxDBv2.authMode = std::clamp(objEl->valueint, 1, 2);

objEl = cJSON_GetObjectItem(cJSON_GetObjectItem(cJsonObject, "influxdbv2"), "token");
if (cJSON_IsString(objEl) && strcmp(objEl->valuestring, "******") != 0) {
Expand Down
2 changes: 1 addition & 1 deletion code/components/webhook_ctrl/interface_webhook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ esp_err_t webhookPublish(const char* _jsonData, ImageData *_imgData, time_t _ima
httpConfig.skip_cert_common_name_check = true; // Skip any validation of server certificate CN field
}
else {
LogFile.writeToFile(ESP_LOG_DEBUG, TAG, "CA Certificate empty, use certification bundle for server verfication");
LogFile.writeToFile(ESP_LOG_DEBUG, TAG, "CA Certificate empty, use certification bundle for server verification");
httpConfig.crt_bundle_attach = esp_crt_bundle_attach;
}

Expand Down
2 changes: 1 addition & 1 deletion code/test/components/config_handling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "."
REQUIRES unity json jomjol_helper
EMBED_TXTFILES ${CMAKE_CURRENT_SOURCE_DIR}/config_json_default_expected.txt
EMBED_TXTFILES config_json_default_expected.txt
config_json_high_limit_expected.txt
config_json_high_limit.txt
config_json_low_limit_expected.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "0.00",
"sequence": [
{
Expand Down Expand Up @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 0,
"authmode": 0,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
16 changes: 15 additions & 1 deletion code/test/components/config_handling/config_json_high_limit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "1.10",
"sequence": [
{
Expand Down Expand Up @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 3,
"authmode": 3,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "1.00",
"sequence": [
{
Expand Down Expand Up @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 2,
"authmode": 2,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
16 changes: 15 additions & 1 deletion code/test/components/config_handling/config_json_low_limit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "-0.10",
"sequence": [
{
Expand Down Expand Up @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": -1,
"authmode": -1,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "0.00",
"sequence": [
{
Expand Down Expand Up @@ -174,7 +174,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
"uri": "",
"bucket": "",
"organization": "",
"authmode": 0,
"authmode": 1,
"token": "",
"tls": {
"cacert": "",
Expand All @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 0,
"authmode": 0,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
18 changes: 16 additions & 2 deletions code/test/components/config_handling/config_json_special.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "0.00",
"sequence": [
{
Expand Down Expand Up @@ -174,7 +174,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
"uri": "",
"bucket": "",
"organization": "",
"authmode": 0,
"authmode": 1,
"token": "",
"tls": {
"cacert": "/ca.crt/",
Expand All @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 0,
"authmode": 0,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
},
"digit": {
"enabled": true,
"model": "dig-class100_0168_s2_q.tflite",
"model": "dig-class100_0173_s2_q.tflite",
"cnngoodthreshold": "0.00",
"sequence": [
{
Expand Down Expand Up @@ -190,6 +190,20 @@ Modify JSON elements accordingly to test lower limits and stringfy as compact ve
}
]
},
"webhook": {
"enabled": false,
"uri": "",
"apikey": "",
"publishimage": 0,
"authmode": 0,
"username": "",
"password": "",
"tls": {
"cacert": "",
"clientcert": "",
"clientkey": ""
}
},
"gpio": {
"customizationenabled": false,
"gpiopin": [
Expand Down
Loading

0 comments on commit fe6efdf

Please sign in to comment.