1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added presence received test

This commit is contained in:
James Booth 2015-05-30 22:44:41 +01:00
parent 272e9f83fc
commit a5cf83d259
3 changed files with 29 additions and 0 deletions

View File

@ -85,6 +85,9 @@ int main(int argc, char* argv[]) {
unit_test_setup_teardown(presence_includes_priority, unit_test_setup_teardown(presence_includes_priority,
init_prof_test, init_prof_test,
close_prof_test), close_prof_test),
unit_test_setup_teardown(presence_received,
init_prof_test,
close_prof_test),
}; };
return run_tests(all_tests); return run_tests(all_tests);

View File

@ -226,3 +226,28 @@ presence_includes_priority(void **state)
)); ));
assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\".")); assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
} }
void
presence_received(void **state)
{
stbbr_for("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");
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>"
"<status>I'm here</status>"
"</presence>"
);
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
}

View File

@ -10,3 +10,4 @@ void presence_chat(void **state);
void presence_chat_with_message(void **state); void presence_chat_with_message(void **state);
void presence_set_priority(void **state); void presence_set_priority(void **state);
void presence_includes_priority(void **state); void presence_includes_priority(void **state);
void presence_received(void **state);