diff options
Diffstat (limited to 'test/interop/username_and_password_test.c')
| -rw-r--r-- | test/interop/username_and_password_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/interop/username_and_password_test.c b/test/interop/username_and_password_test.c new file mode 100644 index 0000000..6e0eaab --- /dev/null +++ b/test/interop/username_and_password_test.c @@ -0,0 +1,30 @@ +#include "greatest.h" +#include "testclient.h" +#include "cleanup.c" +#include "topics.c" + +TEST username_and_password_test() +{ + TestClient *client; + + client = TestClientNew("clienta"); + ASSERT_EQ(0, MqttClientSetAuth(client->client, "myusername", NULL)); + ASSERT(TestClientConnect(client, "localhost", 1883, 60, 1)); + TestClientDisconnect(client); + ASSERT_EQ(0, MqttClientSetAuth(client->client, "myusername", "mypassword")); + ASSERT(TestClientConnect(client, "localhost", 1883, 60, 1)); + TestClientDisconnect(client); + TestClientFree(client); + + PASS(); +} + +GREATEST_MAIN_DEFS(); + +int main(int argc, char **argv) +{ + GREATEST_MAIN_BEGIN(); + cleanup(); + RUN_TEST(username_and_password_test); + GREATEST_MAIN_END(); +} |
