tests: fix functional test receive_carbon

This commit is contained in:
Michael Vetter
2026-03-05 19:45:58 +01:00
parent 897e192544
commit b3d61587e1

View File

@@ -24,7 +24,6 @@ connect_with_carbons_enabled(void** state)
prof_input("/carbons on"); prof_input("/carbons on");
prof_connect(); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>")); "<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
} }
@@ -35,9 +34,10 @@ send_disable_carbons(void** state)
prof_input("/carbons on"); prof_input("/carbons on");
prof_connect(); prof_connect();
assert_true(stbbr_received(
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
prof_input("/carbons off"); prof_input("/carbons off");
assert_true(stbbr_received( assert_true(stbbr_received(
"<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>")); "<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>"));
} }
@@ -46,6 +46,7 @@ void
receive_carbon(void** state) receive_carbon(void** state)
{ {
prof_input("/carbons on"); prof_input("/carbons on");
stbbr_for_xmlns("urn:xmpp:carbons:2", "<iq type='result'/>");
prof_connect(); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
@@ -64,20 +65,21 @@ receive_carbon(void** state)
"<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>" "<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>"
"<received xmlns='urn:xmpp:carbons:2'>" "<received xmlns='urn:xmpp:carbons:2'>"
"<forwarded xmlns='urn:xmpp:forward:0'>" "<forwarded xmlns='urn:xmpp:forward:0'>"
"<message id='prof_msg_7' xmlns='jabber:client' type='chat' lang='en' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>" "<message id='*' xmlns='jabber:client' type='chat' lang='en' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
"<body>test carbon from recipient</body>" "<body>test carbon from recipient</body>"
"</message>" "</message>"
"</forwarded>" "</forwarded>"
"</received>" "</received>"
"</message>"); "</message>");
assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient")); assert_true(prof_output_regex("Buddy1/mobile: test carbon from recipient"));
} }
void void
receive_self_carbon(void** state) receive_self_carbon(void** state)
{ {
prof_input("/carbons on"); prof_input("/carbons on");
stbbr_for_xmlns("urn:xmpp:carbons:2", "<iq type='result'/>");
prof_connect(); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
@@ -96,20 +98,21 @@ receive_self_carbon(void** state)
"<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>" "<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>"
"<sent xmlns='urn:xmpp:carbons:2'>" "<sent xmlns='urn:xmpp:carbons:2'>"
"<forwarded xmlns='urn:xmpp:forward:0'>" "<forwarded xmlns='urn:xmpp:forward:0'>"
"<message id='59' xmlns='jabber:client' type='chat' to='buddy1@localhost/mobile' lang='en' from='stabber@localhost/profanity'>" "<message id='*' xmlns='jabber:client' type='chat' lang='en' to='buddy1@localhost/mobile' from='stabber@localhost/mobile'>"
"<body>self sent carbon</body>" "<body>test carbon from sender</body>"
"</message>" "</message>"
"</forwarded>" "</forwarded>"
"</sent>" "</sent>"
"</message>"); "</message>");
assert_true(prof_output_regex("me: .+self sent carbon")); assert_true(prof_output_regex("me: test carbon from sender"));
} }
void void
receive_private_carbon(void** state) receive_private_carbon(void** state)
{ {
prof_input("/carbons on"); prof_input("/carbons on");
stbbr_for_xmlns("urn:xmpp:carbons:2", "<iq type='result'/>");
prof_connect(); prof_connect();
assert_true(stbbr_received( assert_true(stbbr_received(
@@ -125,10 +128,16 @@ receive_private_carbon(void** state)
assert_true(prof_output_exact("unencrypted")); assert_true(prof_output_exact("unencrypted"));
stbbr_send( stbbr_send(
"<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>" "<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>"
"<received xmlns='urn:xmpp:carbons:2'>"
"<forwarded xmlns='urn:xmpp:forward:0'>"
"<message id='*' xmlns='jabber:client' type='chat' lang='en' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
"<body>Private carbon</body>" "<body>Private carbon</body>"
"<private xmlns='urn:xmpp:carbons:2'/>" "<private xmlns='urn:xmpp:carbons:2'/>"
"</message>"
"</forwarded>"
"</received>"
"</message>"); "</message>");
assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon")); assert_true(prof_output_regex("Buddy1/mobile: Private carbon"));
} }