From c61e9d80ea7724c141d7dc8610b3c3ca6b46f24b Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 20 Dec 2015 02:42:11 +0000 Subject: [PATCH] Added more muc functional tests --- tests/functionaltests/functionaltests.c | 7 +- tests/functionaltests/test_muc.c | 89 ++++++++++++++++++++++++- tests/functionaltests/test_muc.h | 7 +- 3 files changed, 97 insertions(+), 6 deletions(-) diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 39f43b49..b5dfa3ae 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -89,8 +89,11 @@ int main(int argc, char* argv[]) { PROF_FUNC_TEST(sends_room_join_with_nick), PROF_FUNC_TEST(sends_room_join_with_password), PROF_FUNC_TEST(sends_room_join_with_nick_and_password), - PROF_FUNC_TEST(show_role_and_affiliation_on_join), - PROF_FUNC_TEST(show_subject_on_join), + PROF_FUNC_TEST(shows_role_and_affiliation_on_join), + PROF_FUNC_TEST(shows_subject_on_join), + PROF_FUNC_TEST(shows_history_message), + PROF_FUNC_TEST(shows_occupant_join), + PROF_FUNC_TEST(shows_message), }; diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c index 83e383be..5911209e 100644 --- a/tests/functionaltests/test_muc.c +++ b/tests/functionaltests/test_muc.c @@ -91,7 +91,7 @@ sends_room_join_with_nick_and_password(void **state) } void -show_role_and_affiliation_on_join(void **state) +shows_role_and_affiliation_on_join(void **state) { prof_connect(); @@ -111,7 +111,7 @@ show_role_and_affiliation_on_join(void **state) } void -show_subject_on_join(void **state) +shows_subject_on_join(void **state) { prof_connect(); @@ -137,3 +137,88 @@ show_subject_on_join(void **state) assert_true(prof_output_regex("Room subject: .+Test room subject")); } + +void +shows_history_message(void **state) +{ + prof_connect(); + + stbbr_for_id("prof_join_2", + "" + "" + "" + "" + "" + "" + "" + ); + + prof_input("/join testroom@conference.localhost"); + assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none")); + + stbbr_send( + "" + "an old message" + "" + "" + "" + ); + + assert_true(prof_output_regex("testoccupant: an old message")); +} + +void +shows_occupant_join(void **state) +{ + prof_connect(); + + stbbr_for_id("prof_join_2", + "" + "" + "" + "" + "" + "" + "" + ); + + prof_input("/join testroom@conference.localhost"); + assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none")); + + stbbr_send( + "" + "" + "" + "" + "" + ); + + assert_true(prof_output_exact("-> testoccupant has joined the room, role: participant, affiliation: none")); +} + +void +shows_message(void **state) +{ + prof_connect(); + + stbbr_for_id("prof_join_2", + "" + "" + "" + "" + "" + "" + "" + ); + + prof_input("/join testroom@conference.localhost"); + assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none")); + + stbbr_send( + "" + "a new message" + "" + ); + + assert_true(prof_output_regex("testoccupant: .+a new message")); +} diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h index 172e2adb..5b7690cb 100644 --- a/tests/functionaltests/test_muc.h +++ b/tests/functionaltests/test_muc.h @@ -3,5 +3,8 @@ void sends_room_join_with_default_muc_service(void **state); void sends_room_join_with_nick(void **state); void sends_room_join_with_password(void **state); void sends_room_join_with_nick_and_password(void **state); -void show_role_and_affiliation_on_join(void **state); -void show_subject_on_join(void **state); +void shows_role_and_affiliation_on_join(void **state); +void shows_subject_on_join(void **state); +void shows_history_message(void **state); +void shows_occupant_join(void **state); +void shows_message(void **state);