1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Added software version request tests

This commit is contained in:
James Booth 2015-08-04 23:43:19 +01:00
parent 2cb2f83ce3
commit de747e3d46
4 changed files with 67 additions and 0 deletions

View File

@ -104,6 +104,7 @@ functionaltest_sources = \
tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \
tests/functionaltests/test_receipts.c tests/functionaltests/test_receipts.h \
tests/functionaltests/test_roster.c tests/functionaltests/test_roster.h \
tests/functionaltests/test_software.c tests/functionaltests/test_software.h \
tests/functionaltests/functionaltests.c
main_source = src/main.c

View File

@ -19,6 +19,7 @@
#include "test_chat_session.h"
#include "test_receipts.h"
#include "test_roster.h"
#include "test_software.h"
#define PROF_FUNC_TEST(test) unit_test_setup_teardown(test, init_prof_test, close_prof_test)
@ -75,6 +76,9 @@ int main(int argc, char* argv[]) {
PROF_FUNC_TEST(sends_new_item_nick),
PROF_FUNC_TEST(sends_remove_item),
PROF_FUNC_TEST(sends_nick_change),
PROF_FUNC_TEST(send_software_version_request),
PROF_FUNC_TEST(display_software_version_result),
};
return run_tests(all_tests);

View File

@ -0,0 +1,59 @@
#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_software_version_request(void **state)
{
prof_connect();
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>"
"<status>I'm here</status>"
"</presence>"
);
prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");
prof_input("/software buddy1@localhost/mobile");
stbbr_received(
"<iq id=\"*\" to=\"buddy1@localhost/mobile\" type=\"get\">"
"<query xmlns=\"jabber:iq:version\"/>"
"</iq>"
);
}
void
display_software_version_result(void **state)
{
prof_connect();
stbbr_send(
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
"<priority>10</priority>"
"<status>I'm here</status>"
"</presence>"
);
prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");
stbbr_for_query("jabber:iq:version",
"<iq id=\"*\" type=\"result\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
"<query xmlns=\"jabber:iq:version\">"
"<name>Profanity</name>"
"<version>0.4.7dev.master.2cb2f83</version>"
"</query>"
"</iq>"
);
prof_input("/software buddy1@localhost/mobile");
prof_output_exact("buddy1@localhost/mobile:");
prof_output_exact("Name : Profanity");
prof_output_exact("Version : 0.4.7dev.master.2cb2f83");
}

View File

@ -0,0 +1,3 @@
void send_software_version_request(void **state);
void display_software_version_result(void **state);