mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
Conflicts: tests/functionaltests/functionaltests.c
This commit is contained in:
commit
b11fd81b0d
@ -102,6 +102,7 @@ functionaltest_sources = \
|
||||
tests/functionaltests/test_message.c tests/functionaltests/test_message.h \
|
||||
tests/functionaltests/test_chat_session.c tests/functionaltests/test_chat_session.h \
|
||||
tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \
|
||||
tests/functionaltests/test_receipts.c tests/functionaltests/test_receipts.h \
|
||||
tests/functionaltests/functionaltests.c
|
||||
|
||||
main_source = src/main.c
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "test_message.h"
|
||||
#include "test_carbons.h"
|
||||
#include "test_chat_session.h"
|
||||
#include "test_receipts.h"
|
||||
|
||||
#define PROF_FUNC_TEST(test) unit_test_setup_teardown(test, init_prof_test, close_prof_test)
|
||||
|
||||
@ -70,7 +71,9 @@ int main(int argc, char* argv[]) {
|
||||
PROF_FUNC_TEST(send_disable_carbons),
|
||||
PROF_FUNC_TEST(receive_carbon),
|
||||
PROF_FUNC_TEST(receive_self_carbon)
|
||||
*/
|
||||
|
||||
PROF_FUNC_TEST(send_receipt_request),
|
||||
PROF_FUNC_TEST(send_receipt_on_request),
|
||||
};
|
||||
|
||||
return run_tests(all_tests);
|
||||
|
50
tests/functionaltests/test_receipts.c
Normal file
50
tests/functionaltests/test_receipts.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include <glib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stabber.h>
|
||||
#include <expect.h>
|
||||
|
||||
#include "proftest.h"
|
||||
|
||||
void
|
||||
send_receipt_request(void **state)
|
||||
{
|
||||
prof_input("/receipts request on");
|
||||
|
||||
prof_connect();
|
||||
|
||||
prof_input("/msg somejid@someserver.com Hi there");
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<message id=\"*\" type=\"chat\" to=\"somejid@someserver.com\">"
|
||||
"<body>Hi there</body>"
|
||||
"<request xmlns=\"urn:xmpp:receipts\"/>"
|
||||
"</message>"
|
||||
));
|
||||
}
|
||||
|
||||
void
|
||||
send_receipt_on_request(void **state)
|
||||
{
|
||||
prof_input("/receipts send on");
|
||||
|
||||
prof_connect();
|
||||
|
||||
stbbr_send(
|
||||
"<message id=\"msg12213\" type=\"chat\" to=\"stabber@localhost/profanity\" from=\"someuser@server.org/profanity\">"
|
||||
"<body>Wants a receipt</body>"
|
||||
"<request xmlns=\"urn:xmpp:receipts\"/>"
|
||||
"</message>"
|
||||
);
|
||||
|
||||
assert_true(stbbr_received(
|
||||
"<message id=\"*\" to=\"someuser@server.org/profanity\">"
|
||||
"<received id=\"msg12213\" xmlns=\"urn:xmpp:receipts\"/>"
|
||||
"</message>"
|
||||
));
|
||||
}
|
3
tests/functionaltests/test_receipts.h
Normal file
3
tests/functionaltests/test_receipts.h
Normal file
@ -0,0 +1,3 @@
|
||||
void send_receipt_request(void **state);
|
||||
void send_receipt_on_request(void **state);
|
||||
|
Loading…
Reference in New Issue
Block a user