1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added more muc functional tests

This commit is contained in:
James Booth 2015-12-20 02:42:11 +00:00
parent 46a0e6ebed
commit c61e9d80ea
3 changed files with 97 additions and 6 deletions

View File

@ -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_nick),
PROF_FUNC_TEST(sends_room_join_with_password), PROF_FUNC_TEST(sends_room_join_with_password),
PROF_FUNC_TEST(sends_room_join_with_nick_and_password), PROF_FUNC_TEST(sends_room_join_with_nick_and_password),
PROF_FUNC_TEST(show_role_and_affiliation_on_join), PROF_FUNC_TEST(shows_role_and_affiliation_on_join),
PROF_FUNC_TEST(show_subject_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),
}; };

View File

@ -91,7 +91,7 @@ sends_room_join_with_nick_and_password(void **state)
} }
void void
show_role_and_affiliation_on_join(void **state) shows_role_and_affiliation_on_join(void **state)
{ {
prof_connect(); prof_connect();
@ -111,7 +111,7 @@ show_role_and_affiliation_on_join(void **state)
} }
void void
show_subject_on_join(void **state) shows_subject_on_join(void **state)
{ {
prof_connect(); prof_connect();
@ -137,3 +137,88 @@ show_subject_on_join(void **state)
assert_true(prof_output_regex("Room subject: .+Test room subject")); assert_true(prof_output_regex("Room subject: .+Test room subject"));
} }
void
shows_history_message(void **state)
{
prof_connect();
stbbr_for_id("prof_join_2",
"<presence id=\"prof_join_2\" 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>an old message</body>"
"<delay xmlns=\"urn:xmpp:delay\" stamp=\"2015-12-19T23:55:25Z\" from=\"testroom@conference.localhost\"/>"
"<x xmlns=\"jabber:x:delay\" stamp=\"20151219T23:55:25\"/>"
"</message>"
);
assert_true(prof_output_regex("testoccupant: an old message"));
}
void
shows_occupant_join(void **state)
{
prof_connect();
stbbr_for_id("prof_join_2",
"<presence id=\"prof_join_2\" 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(
"<presence to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/testoccupant\">"
"<x xmlns=\"http://jabber.org/protocol/muc#user\">"
"<item role=\"participant\" jid=\"someuser@someserver.org/work\" affiliation=\"none\"/>"
"</x>"
"</presence>"
);
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",
"<presence id=\"prof_join_2\" 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>a new message</body>"
"</message>"
);
assert_true(prof_output_regex("testoccupant: .+a new message"));
}

View File

@ -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_nick(void **state);
void sends_room_join_with_password(void **state); void sends_room_join_with_password(void **state);
void sends_room_join_with_nick_and_password(void **state); void sends_room_join_with_nick_and_password(void **state);
void show_role_and_affiliation_on_join(void **state); void shows_role_and_affiliation_on_join(void **state);
void show_subject_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);