1
0
Fork 0

Add room /me functional tests

This commit is contained in:
James Booth 2018-04-21 20:39:18 +01:00
parent 34aa7a717c
commit ee664bf1d2
3 changed files with 58 additions and 0 deletions

View File

@ -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),

View File

@ -208,6 +208,60 @@ shows_message(void **state)
assert_true(prof_output_regex("testoccupant: .+a new message"));
}
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)
{

View File

@ -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);