Tidied functional tests

This commit is contained in:
James Booth
2015-06-13 19:41:11 +01:00
parent e0783e20db
commit a48b9fcec2
10 changed files with 99 additions and 191 deletions

View File

@@ -14,12 +14,12 @@
void
presence_online(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/online");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
@@ -30,12 +30,12 @@ presence_online(void **state)
void
presence_online_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/online \"Hi there\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<status>Hi there</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -47,12 +47,12 @@ presence_online_with_message(void **state)
void
presence_away(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/away");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>away</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -64,12 +64,12 @@ presence_away(void **state)
void
presence_away_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/away \"I'm not here for a bit\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>away</show>"
"<status>I'm not here for a bit</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -82,12 +82,12 @@ presence_away_with_message(void **state)
void
presence_xa(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/xa");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>xa</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -99,12 +99,12 @@ presence_xa(void **state)
void
presence_xa_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/xa \"Gone to the shops\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<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\"/>"
@@ -117,12 +117,12 @@ presence_xa_with_message(void **state)
void
presence_dnd(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/dnd");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>dnd</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -134,12 +134,12 @@ presence_dnd(void **state)
void
presence_dnd_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/dnd \"Working\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>dnd</show>"
"<status>Working</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -152,12 +152,12 @@ presence_dnd_with_message(void **state)
void
presence_chat(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/chat");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>chat</show>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -169,12 +169,12 @@ presence_chat(void **state)
void
presence_chat_with_message(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<show>chat</show>"
"<status>Free to talk</status>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
@@ -187,12 +187,12 @@ presence_chat_with_message(void **state)
void
presence_set_priority(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/priority 25");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -204,11 +204,11 @@ presence_set_priority(void **state)
void
presence_includes_priority(void **state)
{
prof_connect("stabber@localhost", "password");
prof_connect();
prof_input("/priority 25");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_2\">"
"<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
@@ -217,7 +217,7 @@ presence_includes_priority(void **state)
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<presence id=\"prof_presence_3\">"
"<priority>25</priority>"
"<show>chat</show>"
"<status>Free to talk</status>"
@@ -230,17 +230,7 @@ presence_includes_priority(void **state)
void
presence_received(void **state)
{
stbbr_for_id("roster",
"<iq id=\"roster\" type=\"result\" to=\"stabber@localhost/profanity\">"
"<query xmlns=\"jabber:iq:roster\" ver=\"362\">"
"<item jid=\"buddy1@localhost\" subscription=\"both\" name=\"Buddy1\"/>"
"<item jid=\"buddy2@localhost\" subscription=\"both\" name=\"Buddy2\"/>"
"</query>"
"</iq>"
);
prof_connect("stabber@localhost", "password");
stbbr_wait_for("prof_presence_1");
prof_connect();
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"