tests: Apply coding style to unit tests
This commit is contained in:
@@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
#define PROF_FUNC_TEST(test) cmocka_unit_test_setup_teardown(test, init_prof_test, close_prof_test)
|
#define PROF_FUNC_TEST(test) cmocka_unit_test_setup_teardown(test, init_prof_test, close_prof_test)
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int
|
||||||
|
main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
|
||||||
const struct CMUnitTest all_tests[] = {
|
const struct CMUnitTest all_tests[] = {
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
char *config_orig;
|
char* config_orig;
|
||||||
char *data_orig;
|
char* data_orig;
|
||||||
|
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_create_dir(const char *name)
|
_create_dir(const char* name)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@@ -38,14 +38,14 @@ _create_dir(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_mkdir_recursive(const char *dir)
|
_mkdir_recursive(const char* dir)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
gboolean result = TRUE;
|
gboolean result = TRUE;
|
||||||
|
|
||||||
for (i = 1; i <= strlen(dir); i++) {
|
for (i = 1; i <= strlen(dir); i++) {
|
||||||
if (dir[i] == '/' || dir[i] == '\0') {
|
if (dir[i] == '/' || dir[i] == '\0') {
|
||||||
gchar *next_dir = g_strndup(dir, i);
|
gchar* next_dir = g_strndup(dir, i);
|
||||||
result = _create_dir(next_dir);
|
result = _create_dir(next_dir);
|
||||||
g_free(next_dir);
|
g_free(next_dir);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
@@ -60,7 +60,7 @@ _mkdir_recursive(const char *dir)
|
|||||||
void
|
void
|
||||||
_create_config_dir(void)
|
_create_config_dir(void)
|
||||||
{
|
{
|
||||||
GString *profanity_dir = g_string_new(XDG_CONFIG_HOME);
|
GString* profanity_dir = g_string_new(XDG_CONFIG_HOME);
|
||||||
g_string_append(profanity_dir, "/profanity");
|
g_string_append(profanity_dir, "/profanity");
|
||||||
|
|
||||||
if (!_mkdir_recursive(profanity_dir->str)) {
|
if (!_mkdir_recursive(profanity_dir->str)) {
|
||||||
@@ -73,7 +73,7 @@ _create_config_dir(void)
|
|||||||
void
|
void
|
||||||
_create_data_dir(void)
|
_create_data_dir(void)
|
||||||
{
|
{
|
||||||
GString *profanity_dir = g_string_new(XDG_DATA_HOME);
|
GString* profanity_dir = g_string_new(XDG_DATA_HOME);
|
||||||
g_string_append(profanity_dir, "/profanity");
|
g_string_append(profanity_dir, "/profanity");
|
||||||
|
|
||||||
if (!_mkdir_recursive(profanity_dir->str)) {
|
if (!_mkdir_recursive(profanity_dir->str)) {
|
||||||
@@ -86,7 +86,7 @@ _create_data_dir(void)
|
|||||||
void
|
void
|
||||||
_create_chatlogs_dir(void)
|
_create_chatlogs_dir(void)
|
||||||
{
|
{
|
||||||
GString *chatlogs_dir = g_string_new(XDG_DATA_HOME);
|
GString* chatlogs_dir = g_string_new(XDG_DATA_HOME);
|
||||||
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
||||||
|
|
||||||
if (!_mkdir_recursive(chatlogs_dir->str)) {
|
if (!_mkdir_recursive(chatlogs_dir->str)) {
|
||||||
@@ -99,7 +99,7 @@ _create_chatlogs_dir(void)
|
|||||||
void
|
void
|
||||||
_create_logs_dir(void)
|
_create_logs_dir(void)
|
||||||
{
|
{
|
||||||
GString *logs_dir = g_string_new(XDG_DATA_HOME);
|
GString* logs_dir = g_string_new(XDG_DATA_HOME);
|
||||||
g_string_append(logs_dir, "/profanity/logs");
|
g_string_append(logs_dir, "/profanity/logs");
|
||||||
|
|
||||||
if (!_mkdir_recursive(logs_dir->str)) {
|
if (!_mkdir_recursive(logs_dir->str)) {
|
||||||
@@ -128,17 +128,17 @@ prof_start(void)
|
|||||||
"-c",
|
"-c",
|
||||||
"./tests/functionaltests/start_profanity.sh",
|
"./tests/functionaltests/start_profanity.sh",
|
||||||
NULL);
|
NULL);
|
||||||
FILE *fp = fdopen(fd, "r+");
|
FILE* fp = fdopen(fd, "r+");
|
||||||
|
|
||||||
assert_true(fp != NULL);
|
assert_true(fp != NULL);
|
||||||
|
|
||||||
setbuf(fp, (char *)0);
|
setbuf(fp, (char*)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
init_prof_test(void **state)
|
init_prof_test(void** state)
|
||||||
{
|
{
|
||||||
if (stbbr_start(STBBR_LOGDEBUG ,5230, 0) != 0) {
|
if (stbbr_start(STBBR_LOGDEBUG, 5230, 0) != 0) {
|
||||||
assert_true(FALSE);
|
assert_true(FALSE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ init_prof_test(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
close_prof_test(void **state)
|
close_prof_test(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/quit");
|
prof_input("/quit");
|
||||||
waitpid(exp_pid, NULL, 0);
|
waitpid(exp_pid, NULL, 0);
|
||||||
@@ -205,38 +205,36 @@ close_prof_test(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_input(const char *input)
|
prof_input(const char* input)
|
||||||
{
|
{
|
||||||
GString *inp_str = g_string_new(input);
|
GString* inp_str = g_string_new(input);
|
||||||
g_string_append(inp_str, "\r");
|
g_string_append(inp_str, "\r");
|
||||||
write(fd, inp_str->str, inp_str->len);
|
write(fd, inp_str->str, inp_str->len);
|
||||||
g_string_free(inp_str, TRUE);
|
g_string_free(inp_str, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
prof_output_exact(const char *text)
|
prof_output_exact(const char* text)
|
||||||
{
|
{
|
||||||
return (1 == exp_expectl(fd, exp_exact, text, 1, exp_end));
|
return (1 == exp_expectl(fd, exp_exact, text, 1, exp_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
prof_output_regex(const char *text)
|
prof_output_regex(const char* text)
|
||||||
{
|
{
|
||||||
return (1 == exp_expectl(fd, exp_regexp, text, 1, exp_end));
|
return (1 == exp_expectl(fd, exp_regexp, text, 1, exp_end));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_connect_with_roster(const char *roster)
|
prof_connect_with_roster(const char* roster)
|
||||||
{
|
{
|
||||||
GString *roster_str = g_string_new(
|
GString* roster_str = g_string_new(
|
||||||
"<iq type='result' to='stabber@localhost/profanity'>"
|
"<iq type='result' to='stabber@localhost/profanity'>"
|
||||||
"<query xmlns='jabber:iq:roster' ver='362'>"
|
"<query xmlns='jabber:iq:roster' ver='362'>");
|
||||||
);
|
|
||||||
g_string_append(roster_str, roster);
|
g_string_append(roster_str, roster);
|
||||||
g_string_append(roster_str,
|
g_string_append(roster_str,
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:roster", roster_str->str);
|
stbbr_for_query("jabber:iq:roster", roster_str->str);
|
||||||
g_string_free(roster_str, TRUE);
|
g_string_free(roster_str, TRUE);
|
||||||
@@ -245,8 +243,7 @@ prof_connect_with_roster(const char *roster)
|
|||||||
"<presence id='prof_presence_1' lang='en' to='stabber@localhost/profanity' from='stabber@localhost/profanity'>"
|
"<presence id='prof_presence_1' lang='en' to='stabber@localhost/profanity' from='stabber@localhost/profanity'>"
|
||||||
"<priority>0</priority>"
|
"<priority>0</priority>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io/' ver='f8mrtdyAmhnj8Ca+630bThSL718='/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io/' ver='f8mrtdyAmhnj8Ca+630bThSL718='/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
|
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
|
||||||
prof_input("password");
|
prof_input("password");
|
||||||
@@ -275,6 +272,5 @@ prof_connect(void)
|
|||||||
{
|
{
|
||||||
prof_connect_with_roster(
|
prof_connect_with_roster(
|
||||||
"<item jid='buddy1@localhost' subscription='both' name='Buddy1'/>"
|
"<item jid='buddy1@localhost' subscription='both' name='Buddy1'/>"
|
||||||
"<item jid='buddy2@localhost' subscription='both' name='Buddy2'/>"
|
"<item jid='buddy2@localhost' subscription='both' name='Buddy2'/>");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
#define XDG_CONFIG_HOME "./tests/functionaltests/files/xdg_config_home"
|
#define XDG_CONFIG_HOME "./tests/functionaltests/files/xdg_config_home"
|
||||||
#define XDG_DATA_HOME "./tests/functionaltests/files/xdg_data_home"
|
#define XDG_DATA_HOME "./tests/functionaltests/files/xdg_data_home"
|
||||||
|
|
||||||
int init_prof_test(void **state);
|
int init_prof_test(void** state);
|
||||||
int close_prof_test(void **state);
|
int close_prof_test(void** state);
|
||||||
|
|
||||||
void prof_start(void);
|
void prof_start(void);
|
||||||
void prof_connect(void);
|
void prof_connect(void);
|
||||||
void prof_connect_with_roster(const char *roster);
|
void prof_connect_with_roster(const char* roster);
|
||||||
void prof_input(const char *input);
|
void prof_input(const char* input);
|
||||||
|
|
||||||
int prof_output_exact(const char *text);
|
int prof_output_exact(const char* text);
|
||||||
int prof_output_regex(const char *text);
|
int prof_output_regex(const char* text);
|
||||||
|
|
||||||
void prof_timeout(int timeout);
|
void prof_timeout(int timeout);
|
||||||
void prof_timeout_reset(void);
|
void prof_timeout_reset(void);
|
||||||
|
|||||||
@@ -9,31 +9,29 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
send_enable_carbons(void **state)
|
send_enable_carbons(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_with_carbons_enabled(void **state)
|
connect_with_carbons_enabled(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_disable_carbons(void **state)
|
send_disable_carbons(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
@@ -42,26 +40,23 @@ send_disable_carbons(void **state)
|
|||||||
prof_input("/carbons off");
|
prof_input("/carbons off");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
receive_carbon(void **state)
|
receive_carbon(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>On my mobile</status>"
|
"<status>On my mobile</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
assert_true(prof_output_exact("unencrypted"));
|
assert_true(prof_output_exact("unencrypted"));
|
||||||
@@ -75,28 +70,25 @@ receive_carbon(void **state)
|
|||||||
"</message>"
|
"</message>"
|
||||||
"</forwarded>"
|
"</forwarded>"
|
||||||
"</received>"
|
"</received>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient"));
|
assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
receive_self_carbon(void **state)
|
receive_self_carbon(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>On my mobile</status>"
|
"<status>On my mobile</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
assert_true(prof_output_exact("unencrypted"));
|
assert_true(prof_output_exact("unencrypted"));
|
||||||
@@ -110,28 +102,25 @@ receive_self_carbon(void **state)
|
|||||||
"</message>"
|
"</message>"
|
||||||
"</forwarded>"
|
"</forwarded>"
|
||||||
"</sent>"
|
"</sent>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("me: .+self sent carbon"));
|
assert_true(prof_output_regex("me: .+self sent carbon"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
receive_private_carbon(void **state)
|
receive_private_carbon(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/carbons on");
|
prof_input("/carbons on");
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
|
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>On my mobile</status>"
|
"<status>On my mobile</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
assert_true(prof_output_exact("unencrypted"));
|
assert_true(prof_output_exact("unencrypted"));
|
||||||
@@ -140,8 +129,7 @@ receive_private_carbon(void **state)
|
|||||||
"<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
|
"<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
|
||||||
"<body>Private carbon</body>"
|
"<body>Private carbon</body>"
|
||||||
"<private xmlns='urn:xmpp:carbons:2'/>"
|
"<private xmlns='urn:xmpp:carbons:2'/>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
|
assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
void send_enable_carbons(void **state);
|
void send_enable_carbons(void** state);
|
||||||
void connect_with_carbons_enabled(void **state);
|
void connect_with_carbons_enabled(void** state);
|
||||||
void send_disable_carbons(void **state);
|
void send_disable_carbons(void** state);
|
||||||
void receive_carbon(void **state);
|
void receive_carbon(void** state);
|
||||||
void receive_self_carbon(void **state);
|
void receive_self_carbon(void** state);
|
||||||
void receive_private_carbon(void **state);
|
void receive_private_carbon(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_message_to_barejid_when_contact_offline(void **state)
|
sends_message_to_barejid_when_contact_offline(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -18,20 +18,18 @@ sends_message_to_barejid_when_contact_offline(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost' type='chat'>"
|
"<message id='*' to='buddy1@localhost' type='chat'>"
|
||||||
"<body>Hi there</body>"
|
"<body>Hi there</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_message_to_barejid_when_contact_online(void **state)
|
sends_message_to_barejid_when_contact_online(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Hi there");
|
prof_input("/msg buddy1@localhost Hi there");
|
||||||
@@ -39,27 +37,24 @@ sends_message_to_barejid_when_contact_online(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost' type='chat'>"
|
"<message id='*' to='buddy1@localhost' type='chat'>"
|
||||||
"<body>Hi there</body>"
|
"<body>Hi there</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_message_to_fulljid_when_received_from_fulljid(void **state)
|
sends_message_to_fulljid_when_received_from_fulljid(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>First message</body>"
|
"<body>First message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Hi there");
|
prof_input("/msg buddy1@localhost Hi there");
|
||||||
@@ -67,138 +62,121 @@ sends_message_to_fulljid_when_received_from_fulljid(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Hi there</body>"
|
"<body>Hi there</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_subsequent_messages_to_fulljid(void **state)
|
sends_subsequent_messages_to_fulljid(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>First message</body>"
|
"<body>First message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 1");
|
prof_input("/msg buddy1@localhost Outgoing 1");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Outgoing 1</body>"
|
"<body>Outgoing 1</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 2");
|
prof_input("/msg buddy1@localhost Outgoing 2");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Outgoing 2</body>"
|
"<body>Outgoing 2</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 3");
|
prof_input("/msg buddy1@localhost Outgoing 3");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Outgoing 3</body>"
|
"<body>Outgoing 3</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
resets_to_barejid_after_presence_received(void **state)
|
resets_to_barejid_after_presence_received(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>First message</body>"
|
"<body>First message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 1");
|
prof_input("/msg buddy1@localhost Outgoing 1");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Outgoing 1</body>"
|
"<body>Outgoing 1</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
||||||
"<priority>5</priority>"
|
"<priority>5</priority>"
|
||||||
"<show>dnd</show>"
|
"<show>dnd</show>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));
|
assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 2");
|
prof_input("/msg buddy1@localhost Outgoing 2");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost' type='chat'>"
|
"<message id='*' to='buddy1@localhost' type='chat'>"
|
||||||
"<body>Outgoing 2</body>"
|
"<body>Outgoing 2</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
new_session_when_message_received_from_different_fulljid(void **state)
|
new_session_when_message_received_from_different_fulljid(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
||||||
"<priority>8</priority>"
|
"<priority>8</priority>"
|
||||||
"<show>away</show>"
|
"<show>away</show>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (laptop) is away"));
|
assert_true(prof_output_exact("Buddy1 (laptop) is away"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>From first resource</body>"
|
"<body>From first resource</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 1");
|
prof_input("/msg buddy1@localhost Outgoing 1");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
"<message id='*' to='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Outgoing 1</body>"
|
"<body>Outgoing 1</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/laptop' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/laptop' type='chat'>"
|
||||||
"<body>From second resource</body>"
|
"<body>From second resource</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));
|
assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));
|
||||||
|
|
||||||
prof_input("/msg buddy1@localhost Outgoing 2");
|
prof_input("/msg buddy1@localhost Outgoing 2");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='buddy1@localhost/laptop' type='chat'>"
|
"<message id='*' to='buddy1@localhost/laptop' type='chat'>"
|
||||||
"<body>Outgoing 2</body>"
|
"<body>Outgoing 2</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
void sends_message_to_barejid_when_contact_offline(void **state);
|
void sends_message_to_barejid_when_contact_offline(void** state);
|
||||||
void sends_message_to_barejid_when_contact_online(void **state);
|
void sends_message_to_barejid_when_contact_online(void** state);
|
||||||
void sends_message_to_fulljid_when_received_from_fulljid(void **state);
|
void sends_message_to_fulljid_when_received_from_fulljid(void** state);
|
||||||
void sends_subsequent_messages_to_fulljid(void **state);
|
void sends_subsequent_messages_to_fulljid(void** state);
|
||||||
void resets_to_barejid_after_presence_received(void **state);
|
void resets_to_barejid_after_presence_received(void** state);
|
||||||
void new_session_when_message_received_from_different_fulljid(void **state);
|
void new_session_when_message_received_from_different_fulljid(void** state);
|
||||||
|
|||||||
@@ -9,29 +9,27 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_jid_requests_roster(void **state)
|
connect_jid_requests_roster(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' type='get'><query xmlns='jabber:iq:roster'/></iq>"
|
"<iq id='*' type='get'><query xmlns='jabber:iq:roster'/></iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_jid_sends_presence_after_receiving_roster(void **state)
|
connect_jid_sends_presence_after_receiving_roster(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_jid_requests_bookmarks(void **state)
|
connect_jid_requests_bookmarks(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -40,12 +38,11 @@ connect_jid_requests_bookmarks(void **state)
|
|||||||
"<query xmlns='jabber:iq:private'>"
|
"<query xmlns='jabber:iq:private'>"
|
||||||
"<storage xmlns='storage:bookmarks'/>"
|
"<storage xmlns='storage:bookmarks'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_bad_password(void **state)
|
connect_bad_password(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
|
prof_input("/connect stabber@localhost server 127.0.0.1 port 5230 tls allow");
|
||||||
prof_input("badpassword");
|
prof_input("badpassword");
|
||||||
@@ -54,7 +51,7 @@ connect_bad_password(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connect_shows_presence_updates(void **state)
|
connect_shows_presence_updates(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -62,31 +59,27 @@ connect_shows_presence_updates(void **state)
|
|||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<show>dnd</show>"
|
"<show>dnd</show>"
|
||||||
"<status>busy!</status>"
|
"<status>busy!</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is dnd, \"busy!\""));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
||||||
"<show>chat</show>"
|
"<show>chat</show>"
|
||||||
"<status>Talk to me!</status>"
|
"<status>Talk to me!</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
|
assert_true(prof_output_exact("Buddy1 (laptop) is chat, \"Talk to me!\""));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy2@localhost/work'>"
|
"<presence to='stabber@localhost' from='buddy2@localhost/work'>"
|
||||||
"<show>away</show>"
|
"<show>away</show>"
|
||||||
"<status>Out of office</status>"
|
"<status>Out of office</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
|
assert_true(prof_output_exact("Buddy2 (work) is away, \"Out of office\""));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<show>xa</show>"
|
"<show>xa</show>"
|
||||||
"<status>Gone :(</status>"
|
"<status>Gone :(</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is xa, \"Gone :(\""));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
void connect_jid_requests_roster(void **state);
|
void connect_jid_requests_roster(void** state);
|
||||||
void connect_jid_sends_presence_after_receiving_roster(void **state);
|
void connect_jid_sends_presence_after_receiving_roster(void** state);
|
||||||
void connect_jid_requests_bookmarks(void **state);
|
void connect_jid_requests_bookmarks(void** state);
|
||||||
void connect_bad_password(void **state);
|
void connect_bad_password(void** state);
|
||||||
void connect_shows_presence_updates(void **state);
|
void connect_shows_presence_updates(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
disconnect_ends_session(void **state)
|
disconnect_ends_session(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
void disconnect_ends_session(void **state);
|
void disconnect_ends_session(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
message_send(void **state)
|
message_send(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -18,28 +18,26 @@ message_send(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='somejid@someserver.com' type='chat'>"
|
"<message id='*' to='somejid@someserver.com' type='chat'>"
|
||||||
"<body>Hi there</body>"
|
"<body>Hi there</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("me: .+Hi there"));
|
assert_true(prof_output_regex("me: .+Hi there"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
message_receive_console(void **state)
|
message_receive_console(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
||||||
"<body>How are you?</body>"
|
"<body>How are you?</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
message_receive_chatwin(void **state)
|
message_receive_chatwin(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -49,8 +47,7 @@ message_receive_chatwin(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
||||||
"<body>How are you?</body>"
|
"<body>How are you?</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("someuser@chatserv.org/laptop: .+How are you?"));
|
assert_true(prof_output_regex("someuser@chatserv.org/laptop: .+How are you?"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
void message_send(void **state);
|
void message_send(void** state);
|
||||||
void message_receive_console(void **state);
|
void message_receive_console(void** state);
|
||||||
void message_receive_chatwin(void **state);
|
void message_receive_chatwin(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_room_join(void **state)
|
sends_room_join(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -19,12 +19,11 @@ sends_room_join(void **state)
|
|||||||
"<presence id='*' to='testroom@conference.localhost/stabber'>"
|
"<presence id='*' to='testroom@conference.localhost/stabber'>"
|
||||||
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_room_join_with_nick(void **state)
|
sends_room_join_with_nick(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -34,12 +33,11 @@ sends_room_join_with_nick(void **state)
|
|||||||
"<presence id='*' to='testroom@conference.localhost/testnick'>"
|
"<presence id='*' to='testroom@conference.localhost/testnick'>"
|
||||||
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_room_join_with_password(void **state)
|
sends_room_join_with_password(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -51,12 +49,11 @@ sends_room_join_with_password(void **state)
|
|||||||
"<password>testpassword</password>"
|
"<password>testpassword</password>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_room_join_with_nick_and_password(void **state)
|
sends_room_join_with_nick_and_password(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -68,12 +65,11 @@ sends_room_join_with_nick_and_password(void **state)
|
|||||||
"<password>testpassword</password>"
|
"<password>testpassword</password>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_role_and_affiliation_on_join(void **state)
|
shows_role_and_affiliation_on_join(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -84,8 +80,7 @@ shows_role_and_affiliation_on_join(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
|
|
||||||
@@ -93,7 +88,7 @@ shows_role_and_affiliation_on_join(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_subject_on_join(void **state)
|
shows_subject_on_join(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -104,8 +99,7 @@ shows_subject_on_join(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -114,14 +108,13 @@ shows_subject_on_join(void **state)
|
|||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost'>"
|
||||||
"<subject>Test room subject</subject>"
|
"<subject>Test room subject</subject>"
|
||||||
"<body>anothernick has set the subject to: Test room subject</body>"
|
"<body>anothernick has set the subject to: Test room subject</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("Room subject: .+Test room subject"));
|
assert_true(prof_output_regex("Room subject: .+Test room subject"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_history_message(void **state)
|
shows_history_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -132,8 +125,7 @@ shows_history_message(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -143,14 +135,13 @@ shows_history_message(void **state)
|
|||||||
"<body>an old message</body>"
|
"<body>an old message</body>"
|
||||||
"<delay xmlns='urn:xmpp:delay' stamp='2015-12-19T23:55:25Z' from='testroom@conference.localhost'/>"
|
"<delay xmlns='urn:xmpp:delay' stamp='2015-12-19T23:55:25Z' from='testroom@conference.localhost'/>"
|
||||||
"<x xmlns='jabber:x:delay' stamp='20151219T23:55:25'/>"
|
"<x xmlns='jabber:x:delay' stamp='20151219T23:55:25'/>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("testoccupant: an old message"));
|
assert_true(prof_output_regex("testoccupant: an old message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_occupant_join(void **state)
|
shows_occupant_join(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -161,8 +152,7 @@ shows_occupant_join(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -172,14 +162,13 @@ shows_occupant_join(void **state)
|
|||||||
"<x xmlns='http://jabber.org/protocol/muc#user'>"
|
"<x xmlns='http://jabber.org/protocol/muc#user'>"
|
||||||
"<item role='participant' jid='someuser@someserver.org/work' affiliation='none'/>"
|
"<item role='participant' jid='someuser@someserver.org/work' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("-> testoccupant has joined the room, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> testoccupant has joined the room, role: participant, affiliation: none"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_message(void **state)
|
shows_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -190,8 +179,7 @@ shows_message(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -199,14 +187,13 @@ shows_message(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
||||||
"<body>a new message</body>"
|
"<body>a new message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_regex("testoccupant: .+a new message"));
|
assert_true(prof_output_regex("testoccupant: .+a new message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_me_message_from_occupant(void **state)
|
shows_me_message_from_occupant(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -217,8 +204,7 @@ shows_me_message_from_occupant(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -226,14 +212,13 @@ shows_me_message_from_occupant(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
||||||
"<body>/me did something</body>"
|
"<body>/me did something</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("*testoccupant did something"));
|
assert_true(prof_output_exact("*testoccupant did something"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_me_message_from_self(void **state)
|
shows_me_message_from_self(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -244,8 +229,7 @@ shows_me_message_from_self(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -253,14 +237,13 @@ shows_me_message_from_self(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/stabber'>"
|
||||||
"<body>/me did something</body>"
|
"<body>/me did something</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("*stabber did something"));
|
assert_true(prof_output_exact("*stabber did something"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_all_messages_in_console_when_window_not_focussed(void **state)
|
shows_all_messages_in_console_when_window_not_focussed(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -271,8 +254,7 @@ shows_all_messages_in_console_when_window_not_focussed(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -283,22 +265,20 @@ shows_all_messages_in_console_when_window_not_focussed(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
||||||
"<body>a new message</body>"
|
"<body>a new message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("<< room message: testoccupant in testroom@conference.localhost (win 2)"));
|
assert_true(prof_output_exact("<< room message: testoccupant in testroom@conference.localhost (win 2)"));
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/anotheroccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/anotheroccupant'>"
|
||||||
"<body>some other message</body>"
|
"<body>some other message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("<< room message: anotheroccupant in testroom@conference.localhost (win 2)"));
|
assert_true(prof_output_exact("<< room message: anotheroccupant in testroom@conference.localhost (win 2)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_first_message_in_console_when_window_not_focussed(void **state)
|
shows_first_message_in_console_when_window_not_focussed(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -312,8 +292,7 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -324,8 +303,7 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
||||||
"<body>a new message</body>"
|
"<body>a new message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
|
assert_true(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
|
||||||
prof_input("/clear");
|
prof_input("/clear");
|
||||||
@@ -335,8 +313,7 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/anotheroccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/anotheroccupant'>"
|
||||||
"<body>some other message</body>"
|
"<body>some other message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_timeout(2);
|
prof_timeout(2);
|
||||||
assert_false(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
|
assert_false(prof_output_exact("<< room message: testroom@conference.localhost (win 2)"));
|
||||||
@@ -344,7 +321,7 @@ shows_first_message_in_console_when_window_not_focussed(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_no_message_in_console_when_window_not_focussed(void **state)
|
shows_no_message_in_console_when_window_not_focussed(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -358,8 +335,7 @@ shows_no_message_in_console_when_window_not_focussed(void **state)
|
|||||||
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
"<item role='participant' jid='stabber@localhost/profanity' affiliation='none'/>"
|
||||||
"</x>"
|
"</x>"
|
||||||
"<status code='110'/>"
|
"<status code='110'/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/join testroom@conference.localhost");
|
prof_input("/join testroom@conference.localhost");
|
||||||
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
|
||||||
@@ -370,8 +346,7 @@ shows_no_message_in_console_when_window_not_focussed(void **state)
|
|||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
"<message type='groupchat' to='stabber@localhost/profanity' from='testroom@conference.localhost/testoccupant'>"
|
||||||
"<body>a new message</body>"
|
"<body>a new message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_timeout(2);
|
prof_timeout(2);
|
||||||
assert_false(prof_output_exact("testroom@conference.localhost (win 2)"));
|
assert_false(prof_output_exact("testroom@conference.localhost (win 2)"));
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
void sends_room_join(void **state);
|
void sends_room_join(void** state);
|
||||||
void sends_room_join_with_nick(void **state);
|
void sends_room_join_with_nick(void** state);
|
||||||
void sends_room_join_with_password(void **state);
|
void sends_room_join_with_password(void** state);
|
||||||
void sends_room_join_with_nick_and_password(void **state);
|
void sends_room_join_with_nick_and_password(void** state);
|
||||||
void shows_role_and_affiliation_on_join(void **state);
|
void shows_role_and_affiliation_on_join(void** state);
|
||||||
void shows_subject_on_join(void **state);
|
void shows_subject_on_join(void** state);
|
||||||
void shows_history_message(void **state);
|
void shows_history_message(void** state);
|
||||||
void shows_occupant_join(void **state);
|
void shows_occupant_join(void** state);
|
||||||
void shows_message(void **state);
|
void shows_message(void** state);
|
||||||
void shows_me_message_from_occupant(void **state);
|
void shows_me_message_from_occupant(void** state);
|
||||||
void shows_me_message_from_self(void **state);
|
void shows_me_message_from_self(void** state);
|
||||||
void shows_all_messages_in_console_when_window_not_focussed(void **state);
|
void shows_all_messages_in_console_when_window_not_focussed(void** state);
|
||||||
void shows_first_message_in_console_when_window_not_focussed(void **state);
|
void shows_first_message_in_console_when_window_not_focussed(void** state);
|
||||||
void shows_no_message_in_console_when_window_not_focussed(void **state);
|
void shows_no_message_in_console_when_window_not_focussed(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
ping_server(void **state)
|
ping_server(void** state)
|
||||||
{
|
{
|
||||||
stbbr_for_id("prof_disco_info_onconnect_2",
|
stbbr_for_id("prof_disco_info_onconnect_2",
|
||||||
"<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
"<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||||
@@ -17,15 +17,12 @@ ping_server(void **state)
|
|||||||
"<identity category='server' type='im' name='Prosody'/>"
|
"<identity category='server' type='im' name='Prosody'/>"
|
||||||
"<feature var='urn:xmpp:ping'/>"
|
"<feature var='urn:xmpp:ping'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
stbbr_for_id("prof_ping_4",
|
stbbr_for_id("prof_ping_4",
|
||||||
"<iq id='prof_ping_4' type='result' to='stabber@localhost/profanity'/>"
|
"<iq id='prof_ping_4' type='result' to='stabber@localhost/profanity'/>");
|
||||||
);
|
|
||||||
stbbr_for_id("prof_ping_5",
|
stbbr_for_id("prof_ping_5",
|
||||||
"<iq id='prof_ping_5' type='result' to='stabber@localhost/profanity'/>"
|
"<iq id='prof_ping_5' type='result' to='stabber@localhost/profanity'/>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -33,29 +30,26 @@ ping_server(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='prof_ping_4' type='get'>"
|
"<iq id='prof_ping_4' type='get'>"
|
||||||
"<ping xmlns='urn:xmpp:ping'/>"
|
"<ping xmlns='urn:xmpp:ping'/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Ping response from server"));
|
assert_true(prof_output_exact("Ping response from server"));
|
||||||
|
|
||||||
prof_input("/ping");
|
prof_input("/ping");
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='prof_ping_5' type='get'>"
|
"<iq id='prof_ping_5' type='get'>"
|
||||||
"<ping xmlns='urn:xmpp:ping'/>"
|
"<ping xmlns='urn:xmpp:ping'/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Ping response from server"));
|
assert_true(prof_output_exact("Ping response from server"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ping_server_not_supported(void **state)
|
ping_server_not_supported(void** state)
|
||||||
{
|
{
|
||||||
stbbr_for_id("prof_disco_info_onconnect_2",
|
stbbr_for_id("prof_disco_info_onconnect_2",
|
||||||
"<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
"<iq id='prof_disco_info_onconnect_2' to='stabber@localhost/profanity' type='result' from='localhost'>"
|
||||||
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
"<query xmlns='http://jabber.org/protocol/disco#info'>"
|
||||||
"<identity category='server' type='im' name='Stabber'/>"
|
"<identity category='server' type='im' name='Stabber'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -64,22 +58,21 @@ ping_server_not_supported(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ping_responds_to_server_request(void **state)
|
ping_responds_to_server_request(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<iq id='pingtest1' type='get' to='stabber@localhost/profanity' from='localhost'>"
|
"<iq id='pingtest1' type='get' to='stabber@localhost/profanity' from='localhost'>"
|
||||||
"<ping xmlns='urn:xmpp:ping'/>"
|
"<ping xmlns='urn:xmpp:ping'/>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='pingtest1' type='result' from='stabber@localhost/profanity' to='localhost'/>"
|
"<iq id='pingtest1' type='result' from='stabber@localhost/profanity' to='localhost'/>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ping_jid(void **state)
|
void
|
||||||
|
ping_jid(void** state)
|
||||||
{
|
{
|
||||||
stbbr_for_id("prof_caps_4",
|
stbbr_for_id("prof_caps_4",
|
||||||
"<iq id='prof_caps_4' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
"<iq id='prof_caps_4' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||||
@@ -89,8 +82,7 @@ void ping_jid(void **state)
|
|||||||
"<feature var='http://jabber.org/protocol/disco#info'/>"
|
"<feature var='http://jabber.org/protocol/disco#info'/>"
|
||||||
"<feature var='http://jabber.org/protocol/caps'/>"
|
"<feature var='http://jabber.org/protocol/caps'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -104,31 +96,28 @@ void ping_jid(void **state)
|
|||||||
"node='http://profanity-im.github.io' "
|
"node='http://profanity-im.github.io' "
|
||||||
"ver='LpT2xs3nun7jC2sq4gg3WRDQFZ4='"
|
"ver='LpT2xs3nun7jC2sq4gg3WRDQFZ4='"
|
||||||
"/>"
|
"/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='prof_caps_4' to='buddy1@localhost/mobile' type='get'>"
|
"<iq id='prof_caps_4' to='buddy1@localhost/mobile' type='get'>"
|
||||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
stbbr_for_id("prof_ping_5",
|
stbbr_for_id("prof_ping_5",
|
||||||
"<iq from='buddy1@localhost/mobile' to='stabber@localhost' id='prof_ping_5' type='result'/>"
|
"<iq from='buddy1@localhost/mobile' to='stabber@localhost' id='prof_ping_5' type='result'/>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/ping buddy1@localhost/mobile");
|
prof_input("/ping buddy1@localhost/mobile");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='prof_ping_5' type='get' to='buddy1@localhost/mobile'>"
|
"<iq id='prof_ping_5' type='get' to='buddy1@localhost/mobile'>"
|
||||||
"<ping xmlns='urn:xmpp:ping'/>"
|
"<ping xmlns='urn:xmpp:ping'/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Ping response from buddy1@localhost/mobile"));
|
assert_true(prof_output_exact("Ping response from buddy1@localhost/mobile"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ping_jid_not_supported(void **state)
|
void
|
||||||
|
ping_jid_not_supported(void** state)
|
||||||
{
|
{
|
||||||
stbbr_for_id("prof_caps_4",
|
stbbr_for_id("prof_caps_4",
|
||||||
"<iq id='prof_caps_4' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
"<iq id='prof_caps_4' to='stabber@localhost/profanity' type='result' from='buddy1@localhost/mobile'>"
|
||||||
@@ -137,8 +126,7 @@ void ping_jid_not_supported(void **state)
|
|||||||
"<feature var='http://jabber.org/protocol/disco#info'/>"
|
"<feature var='http://jabber.org/protocol/disco#info'/>"
|
||||||
"<feature var='http://jabber.org/protocol/caps'/>"
|
"<feature var='http://jabber.org/protocol/caps'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -152,15 +140,13 @@ void ping_jid_not_supported(void **state)
|
|||||||
"node='http://profanity-im.github.io' "
|
"node='http://profanity-im.github.io' "
|
||||||
"ver='LpT2xs3nun7jC2sq4gg3WRDQFZ4='"
|
"ver='LpT2xs3nun7jC2sq4gg3WRDQFZ4='"
|
||||||
"/>"
|
"/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='prof_caps_4' to='buddy1@localhost/mobile' type='get'>"
|
"<iq id='prof_caps_4' to='buddy1@localhost/mobile' type='get'>"
|
||||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#LpT2xs3nun7jC2sq4gg3WRDQFZ4='/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
prof_input("/ping buddy1@localhost/mobile");
|
prof_input("/ping buddy1@localhost/mobile");
|
||||||
assert_true(prof_output_exact("buddy1@localhost/mobile does not support ping requests."));
|
assert_true(prof_output_exact("buddy1@localhost/mobile does not support ping requests."));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
void ping_server(void **state);
|
void ping_server(void** state);
|
||||||
void ping_server_not_supported(void **state);
|
void ping_server_not_supported(void** state);
|
||||||
void ping_responds_to_server_request(void **state);
|
void ping_responds_to_server_request(void** state);
|
||||||
void ping_jid(void **state);
|
void ping_jid(void** state);
|
||||||
void ping_jid_not_supported(void **state);
|
void ping_jid_not_supported(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_online(void **state)
|
presence_online(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -18,14 +18,13 @@ presence_online(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<presence id='prof_presence_3'>"
|
"<presence id='prof_presence_3'>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to online (priority 0)"));
|
assert_true(prof_output_exact("Status set to online (priority 0)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_online_with_message(void **state)
|
presence_online_with_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -35,14 +34,13 @@ presence_online_with_message(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<status>Hi there</status>"
|
"<status>Hi there</status>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_away(void **state)
|
presence_away(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -52,14 +50,13 @@ presence_away(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<show>away</show>"
|
"<show>away</show>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to away (priority 0)"));
|
assert_true(prof_output_exact("Status set to away (priority 0)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_away_with_message(void **state)
|
presence_away_with_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -70,14 +67,13 @@ presence_away_with_message(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_xa(void **state)
|
presence_xa(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -87,14 +83,13 @@ presence_xa(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<show>xa</show>"
|
"<show>xa</show>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to xa (priority 0)"));
|
assert_true(prof_output_exact("Status set to xa (priority 0)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_xa_with_message(void **state)
|
presence_xa_with_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -105,14 +100,13 @@ presence_xa_with_message(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_dnd(void **state)
|
presence_dnd(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -122,14 +116,13 @@ presence_dnd(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<show>dnd</show>"
|
"<show>dnd</show>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
|
assert_true(prof_output_exact("Status set to dnd (priority 0)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_dnd_with_message(void **state)
|
presence_dnd_with_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -140,14 +133,13 @@ presence_dnd_with_message(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_chat(void **state)
|
presence_chat(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -157,14 +149,13 @@ presence_chat(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<show>chat</show>"
|
"<show>chat</show>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Status set to chat (priority 0)"));
|
assert_true(prof_output_exact("Status set to chat (priority 0)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_chat_with_message(void **state)
|
presence_chat_with_message(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -175,14 +166,13 @@ presence_chat_with_message(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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
|
void
|
||||||
presence_set_priority(void **state)
|
presence_set_priority(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -192,14 +182,13 @@ presence_set_priority(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<priority>25</priority>"
|
"<priority>25</priority>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Priority set to 25."));
|
assert_true(prof_output_exact("Priority set to 25."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_includes_priority(void **state)
|
presence_includes_priority(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -208,8 +197,7 @@ presence_includes_priority(void **state)
|
|||||||
"<presence id='prof_presence_4'>"
|
"<presence id='prof_presence_4'>"
|
||||||
"<priority>25</priority>"
|
"<priority>25</priority>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Priority set to 25."));
|
assert_true(prof_output_exact("Priority set to 25."));
|
||||||
|
|
||||||
prof_input("/chat \"Free to talk\"");
|
prof_input("/chat \"Free to talk\"");
|
||||||
@@ -219,13 +207,12 @@ presence_includes_priority(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
|
assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_keeps_status(void **state)
|
presence_keeps_status(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -235,8 +222,7 @@ presence_keeps_status(void **state)
|
|||||||
"<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://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</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\"."));
|
||||||
|
|
||||||
prof_input("/priority 25");
|
prof_input("/priority 25");
|
||||||
@@ -246,13 +232,12 @@ presence_keeps_status(void **state)
|
|||||||
"<status>Free to talk</status>"
|
"<status>Free to talk</status>"
|
||||||
"<priority>25</priority>"
|
"<priority>25</priority>"
|
||||||
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://profanity-im.github.io'/>"
|
||||||
"</presence>"
|
"</presence>"));
|
||||||
));
|
|
||||||
assert_true(prof_output_exact("Priority set to 25."));
|
assert_true(prof_output_exact("Priority set to 25."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_received(void **state)
|
presence_received(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -260,15 +245,14 @@ presence_received(void **state)
|
|||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Typical use case for gateways that don't support resources
|
// Typical use case for gateways that don't support resources
|
||||||
void
|
void
|
||||||
presence_missing_resource_defaults(void **state)
|
presence_missing_resource_defaults(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -276,8 +260,7 @@ presence_missing_resource_defaults(void **state)
|
|||||||
"<presence to='stabber@localhost' from='buddy1@localhost'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost'>"
|
||||||
"<priority>15</priority>"
|
"<priority>15</priority>"
|
||||||
"<status>My status</status>"
|
"<status>My status</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Buddy1 is online, \"My status\""));
|
assert_true(prof_output_exact("Buddy1 is online, \"My status\""));
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
void presence_away(void **state);
|
void presence_away(void** state);
|
||||||
void presence_away_with_message(void **state);
|
void presence_away_with_message(void** state);
|
||||||
void presence_online(void **state);
|
void presence_online(void** state);
|
||||||
void presence_online_with_message(void **state);
|
void presence_online_with_message(void** state);
|
||||||
void presence_xa(void **state);
|
void presence_xa(void** state);
|
||||||
void presence_xa_with_message(void **state);
|
void presence_xa_with_message(void** state);
|
||||||
void presence_dnd(void **state);
|
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_set_priority(void** state);
|
||||||
void presence_includes_priority(void **state);
|
void presence_includes_priority(void** state);
|
||||||
void presence_keeps_status(void **state);
|
void presence_keeps_status(void** state);
|
||||||
void presence_received(void **state);
|
void presence_received(void** state);
|
||||||
void presence_missing_resource_defaults(void **state);
|
void presence_missing_resource_defaults(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
does_not_send_receipt_request_to_barejid(void **state)
|
does_not_send_receipt_request_to_barejid(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/receipts request on");
|
prof_input("/receipts request on");
|
||||||
|
|
||||||
@@ -20,12 +20,11 @@ does_not_send_receipt_request_to_barejid(void **state)
|
|||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' type='chat' to='somejid@someserver.com'>"
|
"<message id='*' type='chat' to='somejid@someserver.com'>"
|
||||||
"<body>Hi there</body>"
|
"<body>Hi there</body>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_receipt_request(void **state)
|
send_receipt_request(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/receipts request on");
|
prof_input("/receipts request on");
|
||||||
|
|
||||||
@@ -37,16 +36,14 @@ send_receipt_request(void **state)
|
|||||||
"<identity category='client' name='Profanity 0.5.0' type='console'/>"
|
"<identity category='client' name='Profanity 0.5.0' type='console'/>"
|
||||||
"<feature var='urn:xmpp:receipts'/>"
|
"<feature var='urn:xmpp:receipts'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
|
||||||
"<priority>15</priority>"
|
"<priority>15</priority>"
|
||||||
"<status>My status</status>"
|
"<status>My status</status>"
|
||||||
"<c hash='sha-256' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='hAkb1xZdJV9BQpgGNw8zG5Xsals='/>"
|
"<c hash='sha-256' xmlns='http://jabber.org/protocol/caps' node='http://profanity-im.github.io' ver='hAkb1xZdJV9BQpgGNw8zG5Xsals='/>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_output_exact("Buddy1 is online, \"My status\"");
|
prof_output_exact("Buddy1 is online, \"My status\"");
|
||||||
|
|
||||||
@@ -58,12 +55,11 @@ send_receipt_request(void **state)
|
|||||||
"<message id='*' type='chat' to='buddy1@localhost/laptop'>"
|
"<message id='*' type='chat' to='buddy1@localhost/laptop'>"
|
||||||
"<body>Hi there, where is my receipt?</body>"
|
"<body>Hi there, where is my receipt?</body>"
|
||||||
"<request xmlns='urn:xmpp:receipts'/>"
|
"<request xmlns='urn:xmpp:receipts'/>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_receipt_on_request(void **state)
|
send_receipt_on_request(void** state)
|
||||||
{
|
{
|
||||||
prof_input("/receipts send on");
|
prof_input("/receipts send on");
|
||||||
|
|
||||||
@@ -73,12 +69,10 @@ send_receipt_on_request(void **state)
|
|||||||
"<message id='msg12213' type='chat' to='stabber@localhost/profanity' from='someuser@server.org/profanity'>"
|
"<message id='msg12213' type='chat' to='stabber@localhost/profanity' from='someuser@server.org/profanity'>"
|
||||||
"<body>Wants a receipt</body>"
|
"<body>Wants a receipt</body>"
|
||||||
"<request xmlns='urn:xmpp:receipts'/>"
|
"<request xmlns='urn:xmpp:receipts'/>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<message id='*' to='someuser@server.org/profanity'>"
|
"<message id='*' to='someuser@server.org/profanity'>"
|
||||||
"<received id='msg12213' xmlns='urn:xmpp:receipts'/>"
|
"<received id='msg12213' xmlns='urn:xmpp:receipts'/>"
|
||||||
"</message>"
|
"</message>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
void does_not_send_receipt_request_to_barejid(void **state);
|
void does_not_send_receipt_request_to_barejid(void** state);
|
||||||
void send_receipt_request(void **state);
|
void send_receipt_request(void** state);
|
||||||
void send_receipt_on_request(void **state);
|
void send_receipt_on_request(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
rooms_query(void **state)
|
rooms_query(void** state)
|
||||||
{
|
{
|
||||||
stbbr_for_id("prof_confreq_4",
|
stbbr_for_id("prof_confreq_4",
|
||||||
"<iq id='prof_confreq_4' type='result' to='stabber@localhost/profanity' from='conference.localhost'>"
|
"<iq id='prof_confreq_4' type='result' to='stabber@localhost/profanity' from='conference.localhost'>"
|
||||||
@@ -17,8 +17,7 @@ rooms_query(void **state)
|
|||||||
"<item jid='chatroom@conference.localhost' name='A chat room'/>"
|
"<item jid='chatroom@conference.localhost' name='A chat room'/>"
|
||||||
"<item jid='hangout@conference.localhost' name='Another chat room'/>"
|
"<item jid='hangout@conference.localhost' name='Another chat room'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -30,6 +29,5 @@ rooms_query(void **state)
|
|||||||
assert_true(stbbr_last_received(
|
assert_true(stbbr_last_received(
|
||||||
"<iq id='prof_confreq_4' to='conference.localhost' type='get'>"
|
"<iq id='prof_confreq_4' to='conference.localhost' type='get'>"
|
||||||
"<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
"<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
void rooms_query(void **state);
|
void rooms_query(void** state);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_new_item(void **state)
|
sends_new_item(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -18,8 +18,7 @@ sends_new_item(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='bob@localhost' subscription='none' name=''/>"
|
"<item jid='bob@localhost' subscription='none' name=''/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/roster add bob@localhost");
|
prof_input("/roster add bob@localhost");
|
||||||
|
|
||||||
@@ -28,14 +27,13 @@ sends_new_item(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='bob@localhost' name=''/>"
|
"<item jid='bob@localhost' name=''/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Roster item added: bob@localhost"));
|
assert_true(prof_output_exact("Roster item added: bob@localhost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_new_item_nick(void **state)
|
sends_new_item_nick(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
|
|
||||||
@@ -44,8 +42,7 @@ sends_new_item_nick(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='bob@localhost' subscription='none' name='Bobby'/>"
|
"<item jid='bob@localhost' subscription='none' name='Bobby'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/roster add bob@localhost Bobby");
|
prof_input("/roster add bob@localhost Bobby");
|
||||||
|
|
||||||
@@ -54,27 +51,24 @@ sends_new_item_nick(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='bob@localhost' name='Bobby'/>"
|
"<item jid='bob@localhost' name='Bobby'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Roster item added: bob@localhost (Bobby)"));
|
assert_true(prof_output_exact("Roster item added: bob@localhost (Bobby)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_remove_item(void **state)
|
sends_remove_item(void** state)
|
||||||
{
|
{
|
||||||
prof_connect_with_roster(
|
prof_connect_with_roster(
|
||||||
"<item jid='buddy1@localhost' subscription='both'/>"
|
"<item jid='buddy1@localhost' subscription='both'/>"
|
||||||
"<item jid='buddy2@localhost' subscription='both'/>"
|
"<item jid='buddy2@localhost' subscription='both'/>");
|
||||||
);
|
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:roster",
|
stbbr_for_query("jabber:iq:roster",
|
||||||
"<iq id='*' type='set'>"
|
"<iq id='*' type='set'>"
|
||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='buddy1@localhost' subscription='remove'/>"
|
"<item jid='buddy1@localhost' subscription='remove'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/roster remove buddy1@localhost");
|
prof_input("/roster remove buddy1@localhost");
|
||||||
|
|
||||||
@@ -83,27 +77,24 @@ sends_remove_item(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='buddy1@localhost' subscription='remove'/>"
|
"<item jid='buddy1@localhost' subscription='remove'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
|
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_remove_item_nick(void **state)
|
sends_remove_item_nick(void** state)
|
||||||
{
|
{
|
||||||
prof_connect_with_roster(
|
prof_connect_with_roster(
|
||||||
"<item jid='buddy1@localhost' name='Bobby' subscription='both'/>"
|
"<item jid='buddy1@localhost' name='Bobby' subscription='both'/>"
|
||||||
"<item jid='buddy2@localhost' subscription='both'/>"
|
"<item jid='buddy2@localhost' subscription='both'/>");
|
||||||
);
|
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:roster",
|
stbbr_for_query("jabber:iq:roster",
|
||||||
"<iq id='*' type='set'>"
|
"<iq id='*' type='set'>"
|
||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='buddy1@localhost' subscription='remove'/>"
|
"<item jid='buddy1@localhost' subscription='remove'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/roster remove Bobby");
|
prof_input("/roster remove Bobby");
|
||||||
|
|
||||||
@@ -112,18 +103,16 @@ sends_remove_item_nick(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='buddy1@localhost' subscription='remove'/>"
|
"<item jid='buddy1@localhost' subscription='remove'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
|
|
||||||
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
|
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sends_nick_change(void **state)
|
sends_nick_change(void** state)
|
||||||
{
|
{
|
||||||
prof_connect_with_roster(
|
prof_connect_with_roster(
|
||||||
"<item jid='buddy1@localhost' subscription='both'/>"
|
"<item jid='buddy1@localhost' subscription='both'/>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/roster nick buddy1@localhost Buddy1");
|
prof_input("/roster nick buddy1@localhost Buddy1");
|
||||||
|
|
||||||
@@ -134,6 +123,5 @@ sends_nick_change(void **state)
|
|||||||
"<query xmlns='jabber:iq:roster'>"
|
"<query xmlns='jabber:iq:roster'>"
|
||||||
"<item jid='buddy1@localhost' name='Buddy1'/>"
|
"<item jid='buddy1@localhost' name='Buddy1'/>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
void sends_new_item(void **state);
|
void sends_new_item(void** state);
|
||||||
void sends_new_item_nick(void **state);
|
void sends_new_item_nick(void** state);
|
||||||
void sends_remove_item(void **state);
|
void sends_remove_item(void** state);
|
||||||
void sends_remove_item_nick(void **state);
|
void sends_remove_item_nick(void** state);
|
||||||
void sends_nick_change(void **state);
|
void sends_nick_change(void** state);
|
||||||
|
|||||||
@@ -9,35 +9,32 @@
|
|||||||
#include "proftest.h"
|
#include "proftest.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
send_software_version_request(void **state)
|
send_software_version_request(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
prof_input("/software buddy1@localhost/mobile");
|
prof_input("/software buddy1@localhost/mobile");
|
||||||
|
|
||||||
assert_true(stbbr_received(
|
assert_true(stbbr_received(
|
||||||
"<iq id='*' to='buddy1@localhost/mobile' type='get'>"
|
"<iq id='*' to='buddy1@localhost/mobile' type='get'>"
|
||||||
"<query xmlns='jabber:iq:version'/>"
|
"<query xmlns='jabber:iq:version'/>"
|
||||||
"</iq>"
|
"</iq>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
display_software_version_result(void **state)
|
display_software_version_result(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:version",
|
stbbr_for_query("jabber:iq:version",
|
||||||
@@ -46,25 +43,23 @@ display_software_version_result(void **state)
|
|||||||
"<name>Profanity</name>"
|
"<name>Profanity</name>"
|
||||||
"<version>0.4.7dev.master.2cb2f83</version>"
|
"<version>0.4.7dev.master.2cb2f83</version>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
prof_input("/software buddy1@localhost/mobile");
|
prof_input("/software buddy1@localhost/mobile");
|
||||||
|
|
||||||
// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
|
// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
|
||||||
// assert_true(prof_output_exact("Name : Profanity"));
|
// assert_true(prof_output_exact("Name : Profanity"));
|
||||||
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
|
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shows_message_when_software_version_error(void **state)
|
shows_message_when_software_version_error(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:version",
|
stbbr_for_query("jabber:iq:version",
|
||||||
@@ -73,8 +68,7 @@ shows_message_when_software_version_error(void **state)
|
|||||||
"<error code='503' type='cancel'>"
|
"<error code='503' type='cancel'>"
|
||||||
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
|
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
|
||||||
"</error>"
|
"</error>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
prof_input("/software buddy1@localhost/laptop");
|
prof_input("/software buddy1@localhost/laptop");
|
||||||
|
|
||||||
assert_true(prof_output_exact("Could not get software version: service-unavailable"));
|
assert_true(prof_output_exact("Could not get software version: service-unavailable"));
|
||||||
@@ -82,15 +76,14 @@ shows_message_when_software_version_error(void **state)
|
|||||||
|
|
||||||
// Typical use case for gateways that don't support resources
|
// Typical use case for gateways that don't support resources
|
||||||
void
|
void
|
||||||
display_software_version_result_when_from_domainpart(void **state)
|
display_software_version_result_when_from_domainpart(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 is online, \"I'm here\""));
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:version",
|
stbbr_for_query("jabber:iq:version",
|
||||||
@@ -99,25 +92,23 @@ display_software_version_result_when_from_domainpart(void **state)
|
|||||||
"<name>Some Gateway</name>"
|
"<name>Some Gateway</name>"
|
||||||
"<version>1.0</version>"
|
"<version>1.0</version>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
prof_input("/software buddy1@localhost/__prof_default");
|
prof_input("/software buddy1@localhost/__prof_default");
|
||||||
|
|
||||||
// assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
|
// assert_true(prof_output_exact("buddy1@localhost/__prof_default:"));
|
||||||
// assert_true(prof_output_exact("Name : Some Gateway"));
|
// assert_true(prof_output_exact("Name : Some Gateway"));
|
||||||
assert_true(prof_output_exact("Version : 1.0"));
|
assert_true(prof_output_exact("Version : 1.0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
show_message_in_chat_window_when_no_resource(void **state)
|
show_message_in_chat_window_when_no_resource(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
|
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
@@ -127,23 +118,21 @@ show_message_in_chat_window_when_no_resource(void **state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
display_software_version_result_in_chat(void **state)
|
display_software_version_result_in_chat(void** state)
|
||||||
{
|
{
|
||||||
prof_connect();
|
prof_connect();
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
||||||
"<priority>10</priority>"
|
"<priority>10</priority>"
|
||||||
"<status>I'm here</status>"
|
"<status>I'm here</status>"
|
||||||
"</presence>"
|
"</presence>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
"<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
|
||||||
"<body>Here's a message</body>"
|
"<body>Here's a message</body>"
|
||||||
"</message>"
|
"</message>");
|
||||||
);
|
|
||||||
assert_true(prof_output_exact("Here's a message"));
|
assert_true(prof_output_exact("Here's a message"));
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:version",
|
stbbr_for_query("jabber:iq:version",
|
||||||
@@ -152,12 +141,11 @@ display_software_version_result_in_chat(void **state)
|
|||||||
"<name>Profanity</name>"
|
"<name>Profanity</name>"
|
||||||
"<version>0.4.7dev.master.2cb2f83</version>"
|
"<version>0.4.7dev.master.2cb2f83</version>"
|
||||||
"</query>"
|
"</query>"
|
||||||
"</iq>"
|
"</iq>");
|
||||||
);
|
|
||||||
|
|
||||||
prof_input("/software");
|
prof_input("/software");
|
||||||
|
|
||||||
// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
|
// assert_true(prof_output_exact("buddy1@localhost/mobile:"));
|
||||||
// assert_true(prof_output_exact("Name : Profanity"));
|
// assert_true(prof_output_exact("Name : Profanity"));
|
||||||
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
|
assert_true(prof_output_exact("Version : 0.4.7dev.master.2cb2f83"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
void send_software_version_request(void **state);
|
void send_software_version_request(void** state);
|
||||||
void display_software_version_result(void **state);
|
void display_software_version_result(void** state);
|
||||||
void shows_message_when_software_version_error(void **state);
|
void shows_message_when_software_version_error(void** state);
|
||||||
void display_software_version_result_when_from_domainpart(void **state);
|
void display_software_version_result_when_from_domainpart(void** state);
|
||||||
void show_message_in_chat_window_when_no_resource(void **state);
|
void show_message_in_chat_window_when_no_resource(void** state);
|
||||||
void display_software_version_result_in_chat(void **state);
|
void display_software_version_result_in_chat(void** state);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
void omemo_free(void* a){};
|
void omemo_free(void* a) {};
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
omemo_device_id()
|
omemo_device_id()
|
||||||
|
|||||||
@@ -328,7 +328,9 @@ strip_arg_quotes__returns__stripped_both(void** state)
|
|||||||
free(result);
|
free(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void valid_tls_policy_option__is__correct_for_various_inputs(void** state) {
|
void
|
||||||
|
valid_tls_policy_option__is__correct_for_various_inputs(void** state)
|
||||||
|
{
|
||||||
// Valid inputs
|
// Valid inputs
|
||||||
assert_true(valid_tls_policy_option("force"));
|
assert_true(valid_tls_policy_option("force"));
|
||||||
assert_true(valid_tls_policy_option("allow"));
|
assert_true(valid_tls_policy_option("allow"));
|
||||||
@@ -352,7 +354,9 @@ void valid_tls_policy_option__is__correct_for_various_inputs(void** state) {
|
|||||||
assert_true(valid_tls_policy_option(NULL));
|
assert_true(valid_tls_policy_option(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_expanded_path__returns__expanded(void** state) {
|
void
|
||||||
|
get_expanded_path__returns__expanded(void** state)
|
||||||
|
{
|
||||||
gchar* expanded_path;
|
gchar* expanded_path;
|
||||||
|
|
||||||
// `file://` prefix
|
// `file://` prefix
|
||||||
@@ -378,7 +382,9 @@ void get_expanded_path__returns__expanded(void** state) {
|
|||||||
g_free(expanded_path);
|
g_free(expanded_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtoi_range__returns__true_for_valid_input(void** state) {
|
void
|
||||||
|
strtoi_range__returns__true_for_valid_input(void** state)
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
gchar* err_msg = NULL;
|
gchar* err_msg = NULL;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
@@ -404,7 +410,9 @@ void strtoi_range__returns__true_for_valid_input(void** state) {
|
|||||||
assert_null(err_msg);
|
assert_null(err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtoi_range__returns__false_for_out_of_range(void** state) {
|
void
|
||||||
|
strtoi_range__returns__false_for_out_of_range(void** state)
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
gchar* err_msg = NULL;
|
gchar* err_msg = NULL;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
@@ -431,7 +439,9 @@ void strtoi_range__returns__false_for_out_of_range(void** state) {
|
|||||||
err_msg = NULL;
|
err_msg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtoi_range__returns__false_for_invalid_input(void** state) {
|
void
|
||||||
|
strtoi_range__returns__false_for_invalid_input(void** state)
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
gchar* err_msg = NULL;
|
gchar* err_msg = NULL;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
@@ -451,7 +461,9 @@ void strtoi_range__returns__false_for_invalid_input(void** state) {
|
|||||||
err_msg = NULL;
|
err_msg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtoi_range__returns__false_for_null_empty_input(void** state) {
|
void
|
||||||
|
strtoi_range__returns__false_for_null_empty_input(void** state)
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
gchar* err_msg = NULL;
|
gchar* err_msg = NULL;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
@@ -471,7 +483,9 @@ void strtoi_range__returns__false_for_null_empty_input(void** state) {
|
|||||||
err_msg = NULL;
|
err_msg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtoi_range__returns__correct_values_when_err_msg_null(void** state) {
|
void
|
||||||
|
strtoi_range__returns__correct_values_when_err_msg_null(void** state)
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
@@ -485,7 +499,9 @@ void strtoi_range__returns__correct_values_when_err_msg_null(void** state) {
|
|||||||
assert_false(result);
|
assert_false(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_to_verbosity__returns__correct_values(void** state) {
|
void
|
||||||
|
string_to_verbosity__returns__correct_values(void** state)
|
||||||
|
{
|
||||||
int verbosity;
|
int verbosity;
|
||||||
gchar* err_msg = NULL;
|
gchar* err_msg = NULL;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
@@ -495,21 +511,24 @@ void string_to_verbosity__returns__correct_values(void** state) {
|
|||||||
assert_true(result);
|
assert_true(result);
|
||||||
assert_int_equal(0, verbosity);
|
assert_int_equal(0, verbosity);
|
||||||
assert_null(err_msg);
|
assert_null(err_msg);
|
||||||
g_free(err_msg); err_msg = NULL; // Clear for next test
|
g_free(err_msg);
|
||||||
|
err_msg = NULL; // Clear for next test
|
||||||
|
|
||||||
// Valid input string (1)
|
// Valid input string (1)
|
||||||
result = string_to_verbosity("1", &verbosity, &err_msg);
|
result = string_to_verbosity("1", &verbosity, &err_msg);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
assert_int_equal(1, verbosity);
|
assert_int_equal(1, verbosity);
|
||||||
assert_null(err_msg);
|
assert_null(err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// Valid input string (3)
|
// Valid input string (3)
|
||||||
result = string_to_verbosity("3", &verbosity, &err_msg);
|
result = string_to_verbosity("3", &verbosity, &err_msg);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
assert_int_equal(3, verbosity);
|
assert_int_equal(3, verbosity);
|
||||||
assert_null(err_msg);
|
assert_null(err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// Invalid input string (not a number)
|
// Invalid input string (not a number)
|
||||||
result = string_to_verbosity("profanity", &verbosity, &err_msg);
|
result = string_to_verbosity("profanity", &verbosity, &err_msg);
|
||||||
@@ -522,25 +541,29 @@ void string_to_verbosity__returns__correct_values(void** state) {
|
|||||||
result = string_to_verbosity("-1", &verbosity, &err_msg);
|
result = string_to_verbosity("-1", &verbosity, &err_msg);
|
||||||
assert_false(result);
|
assert_false(result);
|
||||||
assert_string_equal("Value -1 out of range. Must be in 0..3.", err_msg);
|
assert_string_equal("Value -1 out of range. Must be in 0..3.", err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// Valid input string, out of range (too high)
|
// Valid input string, out of range (too high)
|
||||||
result = string_to_verbosity("4", &verbosity, &err_msg);
|
result = string_to_verbosity("4", &verbosity, &err_msg);
|
||||||
assert_false(result);
|
assert_false(result);
|
||||||
assert_string_equal("Value 4 out of range. Must be in 0..3.", err_msg);
|
assert_string_equal("Value 4 out of range. Must be in 0..3.", err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// NULL input string
|
// NULL input string
|
||||||
result = string_to_verbosity(NULL, &verbosity, &err_msg);
|
result = string_to_verbosity(NULL, &verbosity, &err_msg);
|
||||||
assert_false(result);
|
assert_false(result);
|
||||||
assert_string_equal("'str' input pointer can not be NULL", err_msg);
|
assert_string_equal("'str' input pointer can not be NULL", err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// Empty input string
|
// Empty input string
|
||||||
result = string_to_verbosity("", &verbosity, &err_msg);
|
result = string_to_verbosity("", &verbosity, &err_msg);
|
||||||
assert_false(result);
|
assert_false(result);
|
||||||
assert_string_equal("Could not convert \"\" to a number.", err_msg);
|
assert_string_equal("Could not convert \"\" to a number.", err_msg);
|
||||||
g_free(err_msg); err_msg = NULL;
|
g_free(err_msg);
|
||||||
|
err_msg = NULL;
|
||||||
|
|
||||||
// err_msg is NULL
|
// err_msg is NULL
|
||||||
result = string_to_verbosity("abc", &verbosity, NULL);
|
result = string_to_verbosity("abc", &verbosity, NULL);
|
||||||
@@ -874,66 +897,83 @@ get_mentions__tests__various(void** state)
|
|||||||
expected = g_slist_append(expected, GINT_TO_POINTER(6));
|
expected = g_slist_append(expected, GINT_TO_POINTER(6));
|
||||||
actual = get_mentions(FALSE, TRUE, "hello boothj5", "boothj5");
|
actual = get_mentions(FALSE, TRUE, "hello boothj5", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Case insensitive match
|
// Case insensitive match
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(6));
|
expected = g_slist_append(expected, GINT_TO_POINTER(6));
|
||||||
actual = get_mentions(FALSE, FALSE, "hello BOOTHJ5", "boothj5");
|
actual = get_mentions(FALSE, FALSE, "hello BOOTHJ5", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Whole word match
|
// Whole word match
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
||||||
actual = get_mentions(TRUE, TRUE, "boothj5 hello", "boothj5");
|
actual = get_mentions(TRUE, TRUE, "boothj5 hello", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Whole word no match (partial)
|
// Whole word no match (partial)
|
||||||
actual = get_mentions(TRUE, TRUE, "boothj5hello", "boothj5");
|
actual = get_mentions(TRUE, TRUE, "boothj5hello", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
|
actual = NULL;
|
||||||
|
|
||||||
// Multiple matches
|
// Multiple matches
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(14));
|
expected = g_slist_append(expected, GINT_TO_POINTER(14));
|
||||||
actual = get_mentions(FALSE, TRUE, "boothj5 hello boothj5", "boothj5");
|
actual = get_mentions(FALSE, TRUE, "boothj5 hello boothj5", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Nick with punctuation (whole word)
|
// Nick with punctuation (whole word)
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
||||||
actual = get_mentions(TRUE, TRUE, "boothj5: hi", "boothj5");
|
actual = get_mentions(TRUE, TRUE, "boothj5: hi", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Nick surrounded by punctuation
|
// Nick surrounded by punctuation
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(1));
|
expected = g_slist_append(expected, GINT_TO_POINTER(1));
|
||||||
actual = get_mentions(TRUE, TRUE, "(boothj5)", "boothj5");
|
actual = get_mentions(TRUE, TRUE, "(boothj5)", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
|
|
||||||
// Empty message
|
// Empty message
|
||||||
actual = get_mentions(FALSE, TRUE, "", "boothj5");
|
actual = get_mentions(FALSE, TRUE, "", "boothj5");
|
||||||
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
|
actual = NULL;
|
||||||
|
|
||||||
// Empty nick
|
// Empty nick
|
||||||
actual = get_mentions(FALSE, TRUE, "hello", "");
|
actual = get_mentions(FALSE, TRUE, "hello", "");
|
||||||
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
assert_true(_lists_equal(actual, expected)); // expected is NULL
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
|
actual = NULL;
|
||||||
|
|
||||||
// UTF-8 characters
|
// UTF-8 characters
|
||||||
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
expected = g_slist_append(expected, GINT_TO_POINTER(0));
|
||||||
actual = get_mentions(TRUE, TRUE, "我能 hello", "我能");
|
actual = get_mentions(TRUE, TRUE, "我能 hello", "我能");
|
||||||
assert_true(_lists_equal(actual, expected));
|
assert_true(_lists_equal(actual, expected));
|
||||||
g_slist_free(actual); actual = NULL;
|
g_slist_free(actual);
|
||||||
g_slist_free(expected); expected = NULL;
|
actual = NULL;
|
||||||
|
g_slist_free(expected);
|
||||||
|
expected = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1175,7 +1215,9 @@ prof_occurrences__tests__whole(void** state)
|
|||||||
expected = NULL;
|
expected = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_matches_one_of__tests__edge_cases(void** state) {
|
void
|
||||||
|
string_matches_one_of__tests__edge_cases(void** state)
|
||||||
|
{
|
||||||
// is is NULL, is_can_be_null is TRUE -> should return TRUE
|
// is is NULL, is_can_be_null is TRUE -> should return TRUE
|
||||||
assert_true(string_matches_one_of(NULL, NULL, TRUE, "option1", "option2", NULL));
|
assert_true(string_matches_one_of(NULL, NULL, TRUE, "option1", "option2", NULL));
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ aesgcm_file_get(void* userdata)
|
|||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
void aesgcm_download_cancel_processes(ProfWin* window){};
|
void aesgcm_download_cancel_processes(ProfWin* window) {};
|
||||||
void aesgcm_download_add_download(AESGCMDownload* download){};
|
void aesgcm_download_add_download(AESGCMDownload* download) {};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ http_file_get(void* userdata)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_download_cancel_processes(){};
|
void http_download_cancel_processes() {};
|
||||||
void http_download_add_download(){};
|
void http_download_add_download() {};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ file_size(int filedes)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_upload_cancel_processes(){};
|
void http_upload_cancel_processes() {};
|
||||||
void http_upload_add_upload(){};
|
void http_upload_add_upload() {};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -483,10 +483,10 @@ mucwin_unset_message_char(ProfMucWin* mucwin)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_update_entry_message(ProfWin* window, const char* const id, const char* const message){};
|
void win_update_entry_message(ProfWin* window, const char* const id, const char* const message) {};
|
||||||
void win_mark_received(ProfWin* window, const char* const id){};
|
void win_mark_received(ProfWin* window, const char* const id) {};
|
||||||
void win_print_http_transfer(ProfWin* window, const char* const message, char* id){};
|
void win_print_http_transfer(ProfWin* window, const char* const message, char* id) {};
|
||||||
void win_print_loading_history(ProfWin* window){};
|
void win_print_loading_history(ProfWin* window) {};
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_show_roster(void)
|
ui_show_roster(void)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void avatar_pep_subscribe(void){};
|
void avatar_pep_subscribe(void) {};
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
avatar_get_by_nick(const char* nick, gboolean open)
|
avatar_get_by_nick(const char* nick, gboolean open)
|
||||||
|
|||||||
@@ -309,8 +309,8 @@ presence_sub_request_exists(const char* const bare_jid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iq functions
|
// iq functions
|
||||||
void iq_disable_carbons(){};
|
void iq_disable_carbons() {};
|
||||||
void iq_enable_carbons(){};
|
void iq_enable_carbons() {};
|
||||||
void
|
void
|
||||||
iq_send_software_version(const char* const fulljid)
|
iq_send_software_version(const char* const fulljid)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user