diff options
author | James Booth <boothj5@gmail.com> | 2015-05-24 21:46:44 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-05-24 21:46:44 +0100 |
commit | 7fb00a1e15b192c852e7960708276f5915dc70ab (patch) | |
tree | d20b1006ac8c0b99ac219813c4364c4f85950d38 | |
parent | 16b88a6d8f179831c69cb1f5d56ff7c908e6973d (diff) | |
download | profani-tty-7fb00a1e15b192c852e7960708276f5915dc70ab.tar.gz |
Added ping response test
-rw-r--r-- | stabbertests/stabbertestsuite.c | 3 | ||||
-rw-r--r-- | stabbertests/test_connect.c | 22 | ||||
-rw-r--r-- | stabbertests/test_connect.h | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/stabbertests/stabbertestsuite.c b/stabbertests/stabbertestsuite.c index 03b751ae..335ddce5 100644 --- a/stabbertests/stabbertestsuite.c +++ b/stabbertests/stabbertestsuite.c @@ -37,6 +37,9 @@ int main(int argc, char* argv[]) { unit_test_setup_teardown(multiple_pings, init_prof_test, close_prof_test), + unit_test_setup_teardown(responds_to_ping, + init_prof_test, + close_prof_test), }; return run_tests(all_tests); diff --git a/stabbertests/test_connect.c b/stabbertests/test_connect.c index e8a4a3ce..87079b0b 100644 --- a/stabbertests/test_connect.c +++ b/stabbertests/test_connect.c @@ -166,3 +166,25 @@ multiple_pings(void **state) "</iq>" )); } + +void +responds_to_ping(void **state) +{ + will_return(ui_ask_password, strdup("password")); + + expect_any_cons_show(); + + cmd_process_input(strdup("/connect stabber@localhost port 5230")); + prof_process_xmpp(20); + + stbbr_send( + "<iq id=\"ping1\" type=\"get\" to=\"stabber@localhost\" from=\"localhost\">" + "<ping xmlns=\"urn:xmpp:ping\"/>" + "</iq>"); + + prof_process_xmpp(20); + + assert_true(stbbr_verify( + "<iq id=\"ping1\" type=\"result\" from=\"stabber@localhost\" to=\"localhost\"/>" + )); +} diff --git a/stabbertests/test_connect.h b/stabbertests/test_connect.h index df66da05..8e80b113 100644 --- a/stabbertests/test_connect.h +++ b/stabbertests/test_connect.h @@ -5,3 +5,4 @@ void connect_jid_requests_bookmarks(void **state); void connect_bad_password(void **state); void sends_rooms_iq(void **state); void multiple_pings(void **state); +void responds_to_ping(void **state); |