diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functionaltests/functionaltests.c | 1 | ||||
-rw-r--r-- | tests/functionaltests/test_receipts.c | 39 | ||||
-rw-r--r-- | tests/functionaltests/test_receipts.h | 1 | ||||
-rw-r--r-- | tests/unittests/otr/stub_otr.c | 2 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 3 | ||||
-rw-r--r-- | tests/unittests/xmpp/stub_xmpp.c | 11 |
6 files changed, 51 insertions, 6 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 878561dc..d6989377 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -74,6 +74,7 @@ int main(int argc, char* argv[]) { PROF_FUNC_TEST(send_receipt_request), PROF_FUNC_TEST(send_receipt_on_request), + PROF_FUNC_TEST(does_not_send_receipt_request_to_barejid), PROF_FUNC_TEST(sends_new_item), PROF_FUNC_TEST(sends_new_item_nick), PROF_FUNC_TEST(sends_remove_item), diff --git a/tests/functionaltests/test_receipts.c b/tests/functionaltests/test_receipts.c index 6a347f7e..59333a87 100644 --- a/tests/functionaltests/test_receipts.c +++ b/tests/functionaltests/test_receipts.c @@ -12,7 +12,7 @@ #include "proftest.h" void -send_receipt_request(void **state) +does_not_send_receipt_request_to_barejid(void **state) { prof_input("/receipts request on"); @@ -23,6 +23,43 @@ send_receipt_request(void **state) assert_true(stbbr_received( "<message id='*' type='chat' to='somejid@someserver.com'>" "<body>Hi there</body>" + "</message>" + )); +} + +void +send_receipt_request(void **state) +{ + prof_input("/receipts request on"); + + prof_connect(); + + stbbr_for_id("prof_caps_4", + "<iq from='buddy1@localhost/laptop' to='stabber@localhost' id='prof_caps_4' type='result'>" + "<query xmlns='http://jabber.org/protocol/disco#info' node='http://www.profanity.im#hAkb1xZdJV9BQpgGNw8zG5Xsals='>" + "<identity category='client' name='Profanity 0.5.0' type='console'/>" + "<feature var='urn:xmpp:receipts'/>" + "</query>" + "</iq>" + ); + + stbbr_send( + "<presence to='stabber@localhost' from='buddy1@localhost/laptop'>" + "<priority>15</priority>" + "<status>My status</status>" + "<c hash='sha-256' xmlns='http://jabber.org/protocol/caps' node='http://www.profanity.im' ver='hAkb1xZdJV9BQpgGNw8zG5Xsals='/>" + "</presence>" + ); + + prof_output_exact("Buddy1 is online, \"My status\""); + + prof_input("/msg Buddy1"); + prof_input("/resource set laptop"); + prof_input("Hi there, where is my receipt?"); + + assert_true(stbbr_received( + "<message id='*' type='chat' to='buddy1@localhost/laptop'>" + "<body>Hi there, where is my receipt?</body>" "<request xmlns='urn:xmpp:receipts'/>" "</message>" )); diff --git a/tests/functionaltests/test_receipts.h b/tests/functionaltests/test_receipts.h index 5bfa5d1f..65c6fba6 100644 --- a/tests/functionaltests/test_receipts.h +++ b/tests/functionaltests/test_receipts.h @@ -1,3 +1,4 @@ +void does_not_send_receipt_request_to_barejid(void **state); void send_receipt_request(void **state); void send_receipt_on_request(void **state); diff --git a/tests/unittests/otr/stub_otr.c b/tests/unittests/otr/stub_otr.c index 098484d5..5070a66c 100644 --- a/tests/unittests/otr/stub_otr.c +++ b/tests/unittests/otr/stub_otr.c @@ -45,7 +45,7 @@ char* otr_on_message_recv(const char * const barejid, const char * const resourc { return NULL; } -gboolean otr_on_message_send(ProfChatWin *chatwin, const char * const message) +gboolean otr_on_message_send(ProfChatWin *chatwin, const char * const message, gboolean request_receipt) { return FALSE; } diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 2f9c3bdb..928000a3 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -164,7 +164,8 @@ void privwin_incoming_msg(ProfPrivateWin *privatewin, const char * const message void ui_disconnected(void) {} void chatwin_recipient_gone(ProfChatWin *chatwin) {} -void chatwin_outgoing_msg(ProfChatWin *chatwin, const char * const message, char *id, prof_enc_t enc_mode) {} +void chatwin_outgoing_msg(ProfChatWin *chatwin, const char * const message, char *id, prof_enc_t enc_mode, + gboolean request_receipt) {} void chatwin_outgoing_carbon(ProfChatWin *chatwin, const char * const message, prof_enc_t enc_mode) {} void privwin_outgoing_msg(ProfPrivateWin *privwin, const char * const message) {} diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index e77afdcd..c474e82a 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -91,21 +91,22 @@ connection_supports(const char *const feature) } // message functions -char* message_send_chat(const char * const barejid, const char * const msg, const char *const oob_url) +char* message_send_chat(const char * const barejid, const char * const msg, const char *const oob_url, + gboolean request_receipt) { check_expected(barejid); check_expected(msg); return NULL; } -char* message_send_chat_otr(const char * const barejid, const char * const msg) +char* message_send_chat_otr(const char * const barejid, const char * const msg, gboolean request_receipt) { check_expected(barejid); check_expected(msg); return NULL; } -char* message_send_chat_pgp(const char * const barejid, const char * const msg) +char* message_send_chat_pgp(const char * const barejid, const char * const msg, gboolean request_receipt) { return NULL; } @@ -213,6 +214,10 @@ EntityCapabilities* caps_lookup(const char * const jid) void caps_close(void) {} void caps_destroy(EntityCapabilities *caps) {} void caps_reset_ver(void) {} +gboolean caps_jid_has_feature(const char *const jid, const char *const feature) +{ + return FALSE; +} gboolean bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str) { |