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

Added priority tests

This commit is contained in:
James Booth 2015-05-29 01:22:24 +01:00
parent 4ec7892091
commit 272e9f83fc
3 changed files with 94 additions and 43 deletions

View File

@ -79,6 +79,12 @@ int main(int argc, char* argv[]) {
unit_test_setup_teardown(presence_chat_with_message,
init_prof_test,
close_prof_test),
unit_test_setup_teardown(presence_set_priority,
init_prof_test,
close_prof_test),
unit_test_setup_teardown(presence_includes_priority,
init_prof_test,
close_prof_test),
};
return run_tests(all_tests);

View File

@ -183,3 +183,46 @@ presence_chat_with_message(void **state)
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
}
void
presence_set_priority(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/priority 25");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Priority set to 25."));
}
void
presence_includes_priority(void **state)
{
prof_connect("stabber@localhost", "password");
prof_input("/priority 25");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<priority>25</priority>"
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
"</presence>"
));
assert_true(prof_output_exact("Priority set to 25."));
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
"<presence id=\"*\">"
"<priority>25</priority>"
"<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 25), \"Free to talk\"."));
}

View File

@ -8,3 +8,5 @@ void presence_dnd(void **state);
void presence_dnd_with_message(void **state);
void presence_chat(void **state);
void presence_chat_with_message(void **state);
void presence_set_priority(void **state);
void presence_includes_priority(void **state);