aboutsummaryrefslogtreecommitdiff
path: root/test/interop/username_and_password_test.c
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2017-03-18 09:29:19 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2017-03-18 09:29:19 +0200
commit7aeef53b089272f4633cc40512296bfd884a58d4 (patch)
tree894753ced0495f725ad8362859f88d5b61e29eb7 /test/interop/username_and_password_test.c
parente9958e8a0f5aa5fbe0a4a03be42b8bf640add6f7 (diff)
parent2c76b0da9e0aba2211d5b4a8e51c79e47ad9b6c8 (diff)
downloadmqtt-7aeef53b089272f4633cc40512296bfd884a58d4.tar.gz
mqtt-7aeef53b089272f4633cc40512296bfd884a58d4.zip
Merge branch 'the-great-refactor'v0.5
* the-great-refactor: Add big_message_test Fix publish message serialization Modify the code to use nonblocking sockets Fix indentation Free userName and password in MqttClientFree() Add forgotten files Massive refactoring of the internals
Diffstat (limited to 'test/interop/username_and_password_test.c')
-rw-r--r--test/interop/username_and_password_test.c30
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();
+}