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[] = {
|
||||||
|
|
||||||
|
|||||||
@@ -230,13 +230,11 @@ 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'/>");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ send_enable_carbons(void **state)
|
|||||||
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
|
||||||
@@ -28,8 +27,7 @@ connect_with_carbons_enabled(void **state)
|
|||||||
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
|
||||||
@@ -42,8 +40,7 @@ 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
|
||||||
@@ -53,15 +50,13 @@ receive_carbon(void **state)
|
|||||||
|
|
||||||
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,8 +70,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -88,15 +82,13 @@ receive_self_carbon(void **state)
|
|||||||
|
|
||||||
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,8 +102,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -123,15 +114,13 @@ receive_private_carbon(void **state)
|
|||||||
|
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ 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
|
||||||
@@ -30,8 +29,7 @@ sends_message_to_barejid_when_contact_online(void **state)
|
|||||||
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,8 +37,7 @@ 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
|
||||||
@@ -51,15 +48,13 @@ sends_message_to_fulljid_when_received_from_fulljid(void **state)
|
|||||||
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,8 +62,7 @@ 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
|
||||||
@@ -79,37 +73,32 @@ sends_subsequent_messages_to_fulljid(void **state)
|
|||||||
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
|
||||||
@@ -120,38 +109,33 @@ resets_to_barejid_after_presence_received(void **state)
|
|||||||
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
|
||||||
@@ -162,43 +146,37 @@ new_session_when_message_received_from_different_fulljid(void **state)
|
|||||||
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>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ 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
|
||||||
@@ -26,8 +25,7 @@ connect_jid_sends_presence_after_receiving_roster(void **state)
|
|||||||
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
|
||||||
@@ -40,8 +38,7 @@ 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
|
||||||
@@ -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 :(\""));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -32,8 +31,7 @@ message_receive_console(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_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
||||||
}
|
}
|
||||||
@@ -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?"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ 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
|
||||||
@@ -34,8 +33,7 @@ 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
|
||||||
@@ -51,8 +49,7 @@ 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
|
||||||
@@ -68,8 +65,7 @@ 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
|
||||||
@@ -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");
|
||||||
|
|
||||||
@@ -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,8 +108,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +135,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +162,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +187,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +212,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +237,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,16 +265,14 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -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)"));
|
||||||
@@ -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)"));
|
||||||
|
|||||||
@@ -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,16 +30,14 @@ 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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +49,7 @@ ping_server_not_supported(void **state)
|
|||||||
"<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();
|
||||||
|
|
||||||
@@ -71,15 +65,14 @@ ping_responds_to_server_request(void **state)
|
|||||||
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."));
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -35,8 +34,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
@@ -52,8 +50,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -70,8 +67,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
@@ -87,8 +83,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -105,8 +100,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
@@ -122,8 +116,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -140,8 +133,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
@@ -157,8 +149,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -175,8 +166,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
@@ -192,8 +182,7 @@ 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."));
|
||||||
}
|
}
|
||||||
@@ -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,8 +207,7 @@ 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\"."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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,8 +232,7 @@ 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."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,8 +245,7 @@ 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\""));
|
||||||
}
|
}
|
||||||
@@ -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\""));
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ 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
|
||||||
@@ -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,8 +55,7 @@ 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
|
||||||
@@ -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>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,8 +27,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -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,8 +51,7 @@ 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)"));
|
||||||
}
|
}
|
||||||
@@ -65,16 +61,14 @@ 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,8 +77,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -94,16 +87,14 @@ 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,8 +103,7 @@ 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"));
|
||||||
}
|
}
|
||||||
@@ -122,8 +112,7 @@ 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>"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,14 @@ send_software_version_request(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\""));
|
||||||
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
|
||||||
@@ -36,8 +34,7 @@ display_software_version_result(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\""));
|
||||||
|
|
||||||
stbbr_for_query("jabber:iq:version",
|
stbbr_for_query("jabber:iq:version",
|
||||||
@@ -46,8 +43,7 @@ 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:"));
|
||||||
@@ -63,8 +59,7 @@ shows_message_when_software_version_error(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\""));
|
||||||
|
|
||||||
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"));
|
||||||
@@ -89,8 +83,7 @@ display_software_version_result_when_from_domainpart(void **state)
|
|||||||
"<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,8 +92,7 @@ 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:"));
|
||||||
@@ -116,8 +108,7 @@ show_message_in_chat_window_when_no_resource(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\""));
|
||||||
|
|
||||||
prof_input("/msg Buddy1");
|
prof_input("/msg Buddy1");
|
||||||
@@ -134,16 +125,14 @@ display_software_version_result_in_chat(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\""));
|
||||||
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,8 +141,7 @@ 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");
|
||||||
|
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user