fix(pico-sensor): disconnect mqtt client before testing publish
This commit is contained in:
@@ -38,6 +38,7 @@ void test_MqttClient_Publish_Disabled(void) {
|
|||||||
|
|
||||||
// Test that publishing fails with ERR_FAILED if not connected, even if publishing is enabled
|
// Test that publishing fails with ERR_FAILED if not connected, even if publishing is enabled
|
||||||
void test_MqttClient_Publish_NotConnected(void) {
|
void test_MqttClient_Publish_NotConnected(void) {
|
||||||
|
MqttClient_Disconnect(); // Ensure we are not connected
|
||||||
MqttClient_SetDoPublish(true);
|
MqttClient_SetDoPublish(true);
|
||||||
int res = MqttClient_Publish((const unsigned char*)"test/topic", (const unsigned char*)"value");
|
int res = MqttClient_Publish((const unsigned char*)"test/topic", (const unsigned char*)"value");
|
||||||
TEST_ASSERT_EQUAL_INT_MESSAGE(ERR_FAILED, res, "Publish should fail with ERR_FAILED if not connected");
|
TEST_ASSERT_EQUAL_INT_MESSAGE(ERR_FAILED, res, "Publish should fail with ERR_FAILED if not connected");
|
||||||
|
|||||||
Reference in New Issue
Block a user