From: sairoop-elear Date: Fri, 8 Feb 2019 08:05:33 +0000 (+0530) Subject: Update invite API in blackbox test cases X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=3a73d524bf6ea79f8badb83ec15863a546602b7b;p=meshlink Update invite API in blackbox test cases --- diff --git a/src/submesh.h b/src/submesh.h index b5d90b30..b35edf18 100644 --- a/src/submesh.h +++ b/src/submesh.h @@ -20,7 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "meshlink_internal.h" +#include "meshlink.h" typedef struct submesh_t { char *name; /* name of this Sub-Mesh */ diff --git a/test/blackbox/common/test_step.c b/test/blackbox/common/test_step.c index 7681c82e..fbaab897 100644 --- a/test/blackbox/common/test_step.c +++ b/test/blackbox/common/test_step.c @@ -52,7 +52,7 @@ meshlink_handle_t *execute_open(char *node_name, char *dev_class) { } char *execute_invite(char *invitee) { - char *invite_url = meshlink_invite_ex(mesh_handle, invitee, MESHLINK_INVITE_LOCAL | MESHLINK_INVITE_NUMERIC); + char *invite_url = meshlink_invite_ex(mesh_handle, NULL, invitee, MESHLINK_INVITE_LOCAL | MESHLINK_INVITE_NUMERIC); PRINT_TEST_CASE_MSG("meshlink_invite status: %s\n", meshlink_strerror(meshlink_errno)); assert(invite_url); diff --git a/test/blackbox/run_blackbox_tests/test_cases_invite.c b/test/blackbox/run_blackbox_tests/test_cases_invite.c index c0f13c58..af02cb47 100644 --- a/test/blackbox/run_blackbox_tests/test_cases_invite.c +++ b/test/blackbox/run_blackbox_tests/test_cases_invite.c @@ -82,7 +82,7 @@ static bool test_invite_01(void) { assert(mesh_handle); meshlink_set_log_cb(mesh_handle, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger); - char *invitation = meshlink_invite(mesh_handle, "new"); + char *invitation = meshlink_invite(mesh_handle, NULL, "new"); assert_int_equal(invitation, NULL); free(invitation); @@ -104,7 +104,7 @@ static void test_case_invite_02(void **state) { */ static bool test_invite_02(void) { // Trying to generate INVITATION by passing NULL as mesh link handle - char *invitation = meshlink_invite(NULL, "nut"); + char *invitation = meshlink_invite(NULL, NULL, "nut"); assert_int_equal(invitation, NULL); return true; @@ -132,7 +132,7 @@ static bool test_invite_03(void) { meshlink_set_log_cb(mesh_handle, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger); // Trying to generate INVITATION by passing NULL as mesh link handle - char *invitation = meshlink_invite(mesh_handle, NULL); + char *invitation = meshlink_invite(mesh_handle, NULL, NULL); assert_int_equal(invitation, NULL); meshlink_close(mesh_handle); @@ -165,12 +165,12 @@ static bool test_invite_04(void) { char *hostname1 = "127.1.1.1"; bool ret = meshlink_add_address(mesh_handle, hostname1); - char *invitation = meshlink_invite(mesh_handle, "foo"); + char *invitation = meshlink_invite(mesh_handle, NULL, "foo"); assert_int_not_equal(strstr(invitation, hostname1), NULL); char *hostname2 = "127.1.2.3"; ret = meshlink_add_address(mesh_handle, hostname2); - invitation = meshlink_invite(mesh_handle, "bar"); + invitation = meshlink_invite(mesh_handle, NULL, "bar"); // Verify we have both the added addresses assert_int_not_equal(strstr(invitation, hostname1), NULL); diff --git a/test/blackbox/run_blackbox_tests/test_cases_join.c b/test/blackbox/run_blackbox_tests/test_cases_join.c index 9df001af..e91c163c 100644 --- a/test/blackbox/run_blackbox_tests/test_cases_join.c +++ b/test/blackbox/run_blackbox_tests/test_cases_join.c @@ -100,7 +100,7 @@ static bool test_meshlink_join_01(void) { // Inviting nut meshlink_start(mesh2); - char *invitation = meshlink_invite(mesh2, "nut"); + char *invitation = meshlink_invite(mesh2, NULL, "nut"); assert(invitation); // Joining Node-Under-Test with relay @@ -141,7 +141,7 @@ static bool test_meshlink_join_02(void) { assert(mesh1 != NULL); meshlink_set_log_cb(mesh1, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger); - char *invitation = meshlink_invite(mesh1, "nodex"); + char *invitation = meshlink_invite(mesh1, NULL, "nodex"); /* meshlink_join called with NULL as mesh handle and with valid invitation */ bool ret = meshlink_join(NULL, invitation); diff --git a/test/blackbox/util/gen_invite.c b/test/blackbox/util/gen_invite.c index 4014b68b..1517be8a 100644 --- a/test/blackbox/util/gen_invite.c +++ b/test/blackbox/util/gen_invite.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { meshlink_set_log_cb(mesh, MESHLINK_DEBUG, logger_cb); meshlink_enable_discovery(mesh, false); assert(meshlink_start(mesh)); - invite = meshlink_invite_ex(mesh, argv[2], MESHLINK_INVITE_LOCAL | MESHLINK_INVITE_NUMERIC); + invite = meshlink_invite_ex(mesh, NULL, argv[2], MESHLINK_INVITE_LOCAL | MESHLINK_INVITE_NUMERIC); printf("%s\n", invite); meshlink_close(mesh); diff --git a/test/invite-join.c b/test/invite-join.c index 03e16917..eee5fa96 100644 --- a/test/invite-join.c +++ b/test/invite-join.c @@ -55,14 +55,14 @@ int main() { } meshlink_add_address(mesh1, "localhost"); - char *baz_url = meshlink_invite(mesh1, "baz"); + char *baz_url = meshlink_invite(mesh1, NULL, "baz"); if(!baz_url) { fprintf(stderr, "Foo could not generate an invitation for baz\n"); return 1; } - char *quux_url = meshlink_invite(mesh1, "quux"); + char *quux_url = meshlink_invite(mesh1, NULL, "quux"); if(!quux_url) { fprintf(stderr, "Foo could not generate an invitation for quux\n");