diff options
author | James Booth <boothj5@gmail.com> | 2018-04-21 20:39:18 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2018-04-21 20:40:11 +0100 |
commit | ee664bf1d247d74bf8b5c13e2fdddc5070980f5e (patch) | |
tree | a96965f6e350f1cabd2a8ad19e5c2020556ebced /tests/functionaltests | |
parent | 34aa7a717cf3f19b77cd5556f2bda91cdbfb2a30 (diff) | |
download | profani-tty-ee664bf1d247d74bf8b5c13e2fdddc5070980f5e.tar.gz |
Add room /me functional tests
Diffstat (limited to 'tests/functionaltests')
-rw-r--r-- | tests/functionaltests/functionaltests.c | 2 | ||||
-rw-r--r-- | tests/functionaltests/test_muc.c | 54 | ||||
-rw-r--r-- | tests/functionaltests/test_muc.h | 2 |
3 files changed, 58 insertions, 0 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index b634cfd2..5e8656b7 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -101,6 +101,8 @@ int main(int argc, char* argv[]) { PROF_FUNC_TEST(shows_history_message), PROF_FUNC_TEST(shows_occupant_join), PROF_FUNC_TEST(shows_message), + PROF_FUNC_TEST(shows_me_message_from_occupant), + PROF_FUNC_TEST(shows_me_message_from_self), PROF_FUNC_TEST(shows_all_messages_in_console_when_window_not_focussed), PROF_FUNC_TEST(shows_first_message_in_console_when_window_not_focussed), PROF_FUNC_TEST(shows_no_message_in_console_when_window_not_focussed), diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c index e7fc8dcb..3aac9988 100644 --- a/tests/functionaltests/test_muc.c +++ b/tests/functionaltests/test_muc.c @@ -209,6 +209,60 @@ shows_message(void **state) } void +shows_me_message_from_occupant(void **state) +{ + prof_connect(); + + stbbr_for_id("prof_join_4", + "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>" + "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>" + "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>" + "</x>" + "<status code='110'/>" + "</presence>" + ); + + prof_input("/join testroom@conference.localhost"); + assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none")); + + stbbr_send( + "<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>" + "<body>/me did something</body>" + "</message>" + ); + + assert_true(prof_output_exact("*testoccupant did something")); +} + +void +shows_me_message_from_self(void **state) +{ + prof_connect(); + + stbbr_for_id("prof_join_4", + "<presence id='prof_join_4' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>" + "<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='*'/>" + "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>" + "</x>" + "<status code='110'/>" + "</presence>" + ); + + prof_input("/join testroom@conference.localhost"); + assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none")); + + stbbr_send( + "<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>" + "<body>/me did something</body>" + "</message>" + ); + + assert_true(prof_output_exact("*stabber did something")); +} + +void shows_all_messages_in_console_when_window_not_focussed(void **state) { prof_connect(); diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h index 4f3c4f5d..1636bd05 100644 --- a/tests/functionaltests/test_muc.h +++ b/tests/functionaltests/test_muc.h @@ -7,6 +7,8 @@ void shows_subject_on_join(void **state); void shows_history_message(void **state); void shows_occupant_join(void **state); void shows_message(void **state); +void shows_me_message_from_occupant(void **state); +void shows_me_message_from_self(void **state); void shows_all_messages_in_console_when_window_not_focussed(void **state); void shows_first_message_in_console_when_window_not_focussed(void **state); void shows_no_message_in_console_when_window_not_focussed(void **state); |