tests: fix functional test sends_room_join

This commit is contained in:
Michael Vetter
2026-03-05 21:31:25 +01:00
parent e0fbe40757
commit e03b165741

View File

@@ -14,10 +14,10 @@ sends_room_join(void** state)
prof_input("/join testroom@conference.localhost");
assert_true(stbbr_last_received(
"<presence id='*' to='testroom@conference.localhost/stabber'>"
"<x xmlns='http://jabber.org/protocol/muc'/>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
assert_true(stbbr_received(
"<presence id=\"*\" to=\"testroom@conference.localhost/stabber\">"
"<x xmlns=\"http://jabber.org/protocol/muc\"/>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://profanity-im.github.io\"/>"
"</presence>"));
}
@@ -28,10 +28,10 @@ sends_room_join_with_nick(void** state)
prof_input("/join testroom@conference.localhost nick testnick");
assert_true(stbbr_last_received(
"<presence id='*' to='testroom@conference.localhost/testnick'>"
"<x xmlns='http://jabber.org/protocol/muc'/>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
assert_true(stbbr_received(
"<presence id=\"*\" to=\"testroom@conference.localhost/testnick\">"
"<x xmlns=\"http://jabber.org/protocol/muc\"/>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://profanity-im.github.io\"/>"
"</presence>"));
}
@@ -42,12 +42,12 @@ sends_room_join_with_password(void** state)
prof_input("/join testroom@conference.localhost password testpassword");
assert_true(stbbr_last_received(
"<presence id='*' to='testroom@conference.localhost/stabber'>"
"<x xmlns='http://jabber.org/protocol/muc'>"
assert_true(stbbr_received(
"<presence id=\"*\" to=\"testroom@conference.localhost/stabber\">"
"<x xmlns=\"http://jabber.org/protocol/muc\">"
"<password>testpassword</password>"
"</x>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://profanity-im.github.io\"/>"
"</presence>"));
}
@@ -58,12 +58,12 @@ sends_room_join_with_nick_and_password(void** state)
prof_input("/join testroom@conference.localhost nick testnick password testpassword");
assert_true(stbbr_last_received(
"<presence id='*' to='testroom@conference.localhost/testnick'>"
"<x xmlns='http://jabber.org/protocol/muc'>"
assert_true(stbbr_received(
"<presence id=\"*\" to=\"testroom@conference.localhost/testnick\">"
"<x xmlns=\"http://jabber.org/protocol/muc\">"
"<password>testpassword</password>"
"</x>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://profanity-im.github.io\"/>"
"</presence>"));
}
@@ -72,7 +72,7 @@ shows_role_and_affiliation_on_join(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -91,7 +91,7 @@ shows_subject_on_join(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -109,7 +109,7 @@ shows_subject_on_join(void** state)
"<body>anothernick has set the subject to: Test room subject</body>"
"</message>");
assert_true(prof_output_regex("Room subject: .+Test room subject"));
assert_true(prof_output_exact("Room subject: Test room subject"));
}
void
@@ -117,7 +117,7 @@ shows_history_message(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -136,15 +136,17 @@ shows_history_message(void** state)
"<x xmlns='jabber:x:delay' stamp='20151219T23:55:25'/>"
"</message>");
assert_true(prof_output_regex("testoccupant: an old message"));
assert_true(prof_output_exact("testoccupant: an old message"));
}
void
shows_occupant_join(void** state)
{
prof_connect();
prof_input("/presence room all");
assert_true(prof_output_exact("All presence updates will appear in chat room windows."));
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -171,7 +173,7 @@ shows_message(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -188,7 +190,7 @@ shows_message(void** state)
"<body>a new message</body>"
"</message>");
assert_true(prof_output_regex("testoccupant: .+a new message"));
assert_true(prof_output_exact("testoccupant: a new message"));
}
void
@@ -196,7 +198,7 @@ shows_me_message_from_occupant(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -221,7 +223,7 @@ shows_me_message_from_self(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -246,7 +248,7 @@ shows_all_messages_in_console_when_window_not_focussed(void** state)
{
prof_connect();
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -284,7 +286,7 @@ shows_first_message_in_console_when_window_not_focussed(void** state)
prof_input("/console muc first");
assert_true(prof_output_exact("Console MUC messages set: first"));
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"
@@ -304,7 +306,7 @@ shows_first_message_in_console_when_window_not_focussed(void** state)
"<body>a new message</body>"
"</message>");
assert_true(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
assert_true(prof_output_exact("<< room message: testoccupant in testroom@conference.localhost (win 2)"));
prof_input("/clear");
prof_input("/about");
assert_true(prof_output_exact("Type '/help' to show complete help."));
@@ -315,7 +317,7 @@ shows_first_message_in_console_when_window_not_focussed(void** state)
"</message>");
prof_timeout(2);
assert_false(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
assert_false(prof_output_exact("<< room message: anotheroccupant in testroom@conference.localhost (win 2)"));
prof_timeout_reset();
}
@@ -327,7 +329,7 @@ shows_no_message_in_console_when_window_not_focussed(void** state)
prof_input("/console muc none");
assert_true(prof_output_exact("Console MUC messages set: none"));
stbbr_for_id("prof_join_*",
stbbr_for_id("presence:*",
"<presence id='prof_join_*' lang='en' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='*'/>"
"<x xmlns='http://jabber.org/protocol/muc#user'>"