tests: fix functional test test_ping
This commit is contained in:
@@ -10,31 +10,29 @@
|
||||
void
|
||||
ping_server(void** state)
|
||||
{
|
||||
stbbr_for_id("prof_disco_info_onconnect_*",
|
||||
"<iq id='prof_disco_info_onconnect_*' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
||||
"<identity category='server' type='im' name='Prosody'/>"
|
||||
"<feature var='urn:xmpp:ping'/>"
|
||||
"</query>"
|
||||
"</iq>");
|
||||
|
||||
stbbr_for_id("prof_ping_*",
|
||||
"<iq id='prof_ping_*' type='result' to='stabber@localhost/profanity'/>");
|
||||
stbbr_for_id("prof_ping_*",
|
||||
"<iq id='prof_ping_*' type='result' to='stabber@localhost/profanity'/>");
|
||||
stbbr_for_xmlns("urn:xmpp:ping",
|
||||
"<iq id='*' type='result' to='stabber@localhost/profanity'/>");
|
||||
|
||||
prof_connect();
|
||||
|
||||
prof_input("/ping");
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='prof_ping_*' type='get'>"
|
||||
"<iq id='*' type='get'>"
|
||||
"<ping xmlns='urn:xmpp:ping'/>"
|
||||
"</iq>"));
|
||||
assert_true(prof_output_exact("Ping response from server"));
|
||||
|
||||
prof_input("/ping");
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='prof_ping_*' type='get'>"
|
||||
"<iq id='*' type='get'>"
|
||||
"<ping xmlns='urn:xmpp:ping'/>"
|
||||
"</iq>"));
|
||||
assert_true(prof_output_exact("Ping response from server"));
|
||||
@@ -43,8 +41,8 @@ ping_server(void** state)
|
||||
void
|
||||
ping_server_not_supported(void** state)
|
||||
{
|
||||
stbbr_for_id("prof_disco_info_onconnect_*",
|
||||
"<iq id='prof_disco_info_onconnect_*' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||
"<iq id='*' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
||||
"<identity category='server' type='im' name='Stabber'/>"
|
||||
"</query>"
|
||||
@@ -67,14 +65,14 @@ ping_responds_to_server_request(void** state)
|
||||
"</iq>");
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='pingtest1' type='result' from='stabber@localhost/profanity' to='localhost'/>"));
|
||||
"<iq id='pingtest1' to='localhost' type='result'/>"));
|
||||
}
|
||||
|
||||
void
|
||||
ping_jid(void** state)
|
||||
{
|
||||
stbbr_for_id("prof_caps_*",
|
||||
"<iq id='prof_caps_*' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||
stbbr_for_id("*",
|
||||
"<iq id='*' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='>"
|
||||
"<identity category='client' type='console' name='Profanity0.6.0'/>"
|
||||
"<feature var='urn:xmpp:ping'/>"
|
||||
@@ -83,6 +81,9 @@ ping_jid(void** state)
|
||||
"</query>"
|
||||
"</iq>");
|
||||
|
||||
stbbr_for_xmlns("urn:xmpp:ping",
|
||||
"<iq id='*' type='result' from='buddy1@localhost/mobile' to='stabber@localhost/profanity'/>");
|
||||
|
||||
prof_connect();
|
||||
|
||||
stbbr_send(
|
||||
@@ -99,17 +100,14 @@ ping_jid(void** state)
|
||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='prof_caps_*' to='buddy1@localhost/mobile' type='get'>"
|
||||
"<iq id='*' to='buddy1@localhost/mobile' type='get'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
||||
"</iq>"));
|
||||
|
||||
stbbr_for_id("prof_ping_*",
|
||||
"<iq from='buddy1@localhost/mobile' to='stabber@localhost' id='prof_ping_*' type='result'/>");
|
||||
|
||||
prof_input("/ping buddy1@localhost/mobile");
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='prof_ping_*' type='get' to='buddy1@localhost/mobile'>"
|
||||
"<iq id='*' type='get' to='buddy1@localhost/mobile'>"
|
||||
"<ping xmlns='urn:xmpp:ping'/>"
|
||||
"</iq>"));
|
||||
assert_true(prof_output_exact("Ping response from buddy1@localhost/mobile"));
|
||||
@@ -118,8 +116,8 @@ ping_jid(void** state)
|
||||
void
|
||||
ping_jid_not_supported(void** state)
|
||||
{
|
||||
stbbr_for_id("prof_caps_*",
|
||||
"<iq id='prof_caps_*' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||
stbbr_for_id("*",
|
||||
"<iq id='*' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='>"
|
||||
"<identity category='client' type='console' name='Profanity0.6.0'/>"
|
||||
"<feature var='http://jabber.org/protocol/disco#info'/>"
|
||||
@@ -143,7 +141,7 @@ ping_jid_not_supported(void** state)
|
||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<iq id='prof_caps_*' to='buddy1@localhost/mobile' type='get'>"
|
||||
"<iq id='*' to='buddy1@localhost/mobile' type='get'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
||||
"</iq>"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user