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:
parent
4ec7892091
commit
272e9f83fc
@ -79,6 +79,12 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test_setup_teardown(presence_chat_with_message,
|
unit_test_setup_teardown(presence_chat_with_message,
|
||||||
init_prof_test,
|
init_prof_test,
|
||||||
close_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);
|
return run_tests(all_tests);
|
||||||
|
@ -19,9 +19,9 @@ presence_online(void **state)
|
|||||||
prof_input("/online");
|
prof_input("/online");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to online (priority 0)"));
|
assert_true(prof_output_exact("Status set to online (priority 0)"));
|
||||||
@ -35,10 +35,10 @@ presence_online_with_message(void **state)
|
|||||||
prof_input("/online \"Hi there\"");
|
prof_input("/online \"Hi there\"");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<status>Hi there</status>"
|
"<status>Hi there</status>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to online (priority 0), \"Hi there\"."));
|
assert_true(prof_output_exact("Status set to online (priority 0), \"Hi there\"."));
|
||||||
@ -52,10 +52,10 @@ presence_away(void **state)
|
|||||||
prof_input("/away");
|
prof_input("/away");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>away</show>"
|
"<show>away</show>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to away (priority 0)"));
|
assert_true(prof_output_exact("Status set to away (priority 0)"));
|
||||||
@ -69,11 +69,11 @@ presence_away_with_message(void **state)
|
|||||||
prof_input("/away \"I'm not here for a bit\"");
|
prof_input("/away \"I'm not here for a bit\"");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>away</show>"
|
"<show>away</show>"
|
||||||
"<status>I'm not here for a bit</status>"
|
"<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\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to away (priority 0), \"I'm not here for a bit\"."));
|
assert_true(prof_output_exact("Status set to away (priority 0), \"I'm not here for a bit\"."));
|
||||||
@ -87,10 +87,10 @@ presence_xa(void **state)
|
|||||||
prof_input("/xa");
|
prof_input("/xa");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>xa</show>"
|
"<show>xa</show>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to xa (priority 0)"));
|
assert_true(prof_output_exact("Status set to xa (priority 0)"));
|
||||||
@ -104,11 +104,11 @@ presence_xa_with_message(void **state)
|
|||||||
prof_input("/xa \"Gone to the shops\"");
|
prof_input("/xa \"Gone to the shops\"");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>xa</show>"
|
"<show>xa</show>"
|
||||||
"<status>Gone to the shops</status>"
|
"<status>Gone to the shops</status>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to xa (priority 0), \"Gone to the shops\"."));
|
assert_true(prof_output_exact("Status set to xa (priority 0), \"Gone to the shops\"."));
|
||||||
@ -122,10 +122,10 @@ presence_dnd(void **state)
|
|||||||
prof_input("/dnd");
|
prof_input("/dnd");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>dnd</show>"
|
"<show>dnd</show>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
|
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
|
||||||
@ -139,11 +139,11 @@ presence_dnd_with_message(void **state)
|
|||||||
prof_input("/dnd \"Working\"");
|
prof_input("/dnd \"Working\"");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>dnd</show>"
|
"<show>dnd</show>"
|
||||||
"<status>Working</status>"
|
"<status>Working</status>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to dnd (priority 0), \"Working\"."));
|
assert_true(prof_output_exact("Status set to dnd (priority 0), \"Working\"."));
|
||||||
@ -157,10 +157,10 @@ presence_chat(void **state)
|
|||||||
prof_input("/chat");
|
prof_input("/chat");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>chat</show>"
|
"<show>chat</show>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to chat (priority 0)"));
|
assert_true(prof_output_exact("Status set to chat (priority 0)"));
|
||||||
@ -174,12 +174,55 @@ presence_chat_with_message(void **state)
|
|||||||
prof_input("/chat \"Free to talk\"");
|
prof_input("/chat \"Free to talk\"");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id=\"*\">"
|
"<presence id=\"*\">"
|
||||||
"<show>chat</show>"
|
"<show>chat</show>"
|
||||||
"<status>Free to talk</status>"
|
"<status>Free to talk</status>"
|
||||||
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
"<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" ver=\"*\" node=\"http://www.profanity.im\"/>"
|
||||||
"</presence>"
|
"</presence>"
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
|
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\"."));
|
||||||
|
}
|
||||||
|
@ -8,3 +8,5 @@ void presence_dnd(void **state);
|
|||||||
void presence_dnd_with_message(void **state);
|
void presence_dnd_with_message(void **state);
|
||||||
void presence_chat(void **state);
|
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_includes_priority(void **state);
|
||||||
|
Loading…
Reference in New Issue
Block a user