Added remaining presence tests

This commit is contained in:
James Booth
2015-05-29 01:10:45 +01:00
parent a522d0225d
commit 4ec7892091
3 changed files with 170 additions and 0 deletions

View File

@@ -11,6 +11,39 @@
#include "proftest.h"
void
presence_online(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/online");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to online (priority 0)"));
}
void
presence_online_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/online \"Hi there\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<status>Hi there</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to online (priority 0), \"Hi there\"."));
}
void
presence_away(void **state)
{
@@ -45,3 +78,108 @@ presence_away_with_message(void **state)
assert_true(prof_output_exact("Status set to away (priority 0), \"I'm not here for a bit\"."));
}
void
presence_xa(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/xa");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>xa</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to xa (priority 0)"));
}
void
presence_xa_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/xa \"Gone to the shops\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>xa</show>"
"<status>Gone to the shops</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to xa (priority 0), \"Gone to the shops\"."));
}
void
presence_dnd(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/dnd");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>dnd</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
}
void
presence_dnd_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/dnd \"Working\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>dnd</show>"
"<status>Working</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to dnd (priority 0), \"Working\"."));
}
void
presence_chat(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/chat");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>chat</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to chat (priority 0)"));
}
void
presence_chat_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<show>chat</show>"
"<status>Free to talk</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
}