#include #include #include #include #include #include #include #include #include #include "proftest.h" void send_software_version_request(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); prof_input("/software buddy1@localhost/mobile"); assert_true(stbbr_received( "" "" "" )); } void display_software_version_result(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); stbbr_for_query("jabber:iq:version", "" "" "Profanity" "0.4.7dev.master.2cb2f83" "" "" ); prof_input("/software buddy1@localhost/mobile"); // assert_true(prof_output_exact("buddy1@localhost/mobile:")); // assert_true(prof_output_exact("Name : Profanity")); assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83")); } void shows_message_when_software_version_error(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); stbbr_for_query("jabber:iq:version", "" "" "" "" "" "" ); prof_input("/software buddy1@localhost/laptop"); assert_true(prof_output_exact("Could not get software version: service-unavailable")); } // Typical use case for gateways that don't support resources void display_software_version_result_when_from_domainpart(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 is online, \"I'm here\"")); stbbr_for_query("jabber:iq:version", "" "" "Some Gateway" "1.0" "" "" ); prof_input("/software buddy1@localhost/__prof_default"); // assert_true(prof_output_exact("buddy1@localhost/__prof_default:")); // assert_true(prof_output_exact("Name : Some Gateway")); assert_true(prof_output_exact("Version : 1.0")); } void show_message_in_chat_window_when_no_resource(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); prof_input("/msg Buddy1"); prof_input("/software"); assert_true(prof_output_exact("Unknown resource for /software command.")); } void display_software_version_result_in_chat(void **state) { prof_connect(); stbbr_send( "" "10" "I'm here" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); prof_input("/msg Buddy1"); stbbr_send( "" "Here's a message" "" ); assert_true(prof_output_exact("Here's a message")); stbbr_for_query("jabber:iq:version", "" "" "Profanity" "0.4.7dev.master.2cb2f83" "" "" ); prof_input("/software"); // assert_true(prof_output_exact("buddy1@localhost/mobile:")); // assert_true(prof_output_exact("Name : Profanity")); assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83")); }