mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added test for showing message when changing priority
This commit is contained in:
parent
a2c0dab474
commit
b466809245
@ -188,6 +188,12 @@ _mock_accounts_set_priority_online(const char * const account_name, const gint v
|
|||||||
check_expected(value);
|
check_expected(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_stub_accounts_set_priority_online(const char * const account_name, const gint value)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mock_accounts_set_priority_chat(const char * const account_name, const gint value)
|
_mock_accounts_set_priority_chat(const char * const account_name, const gint value)
|
||||||
{
|
{
|
||||||
@ -195,6 +201,12 @@ _mock_accounts_set_priority_chat(const char * const account_name, const gint val
|
|||||||
check_expected(value);
|
check_expected(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_stub_accounts_set_priority_chat(const char * const account_name, const gint value)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mock_accounts_set_priority_away(const char * const account_name, const gint value)
|
_mock_accounts_set_priority_away(const char * const account_name, const gint value)
|
||||||
{
|
{
|
||||||
@ -202,6 +214,12 @@ _mock_accounts_set_priority_away(const char * const account_name, const gint val
|
|||||||
check_expected(value);
|
check_expected(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_stub_accounts_set_priority_away(const char * const account_name, const gint value)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mock_accounts_set_priority_xa(const char * const account_name, const gint value)
|
_mock_accounts_set_priority_xa(const char * const account_name, const gint value)
|
||||||
{
|
{
|
||||||
@ -209,6 +227,12 @@ _mock_accounts_set_priority_xa(const char * const account_name, const gint value
|
|||||||
check_expected(value);
|
check_expected(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_stub_accounts_set_priority_xa(const char * const account_name, const gint value)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mock_accounts_set_priority_dnd(const char * const account_name, const gint value)
|
_mock_accounts_set_priority_dnd(const char * const account_name, const gint value)
|
||||||
{
|
{
|
||||||
@ -216,6 +240,11 @@ _mock_accounts_set_priority_dnd(const char * const account_name, const gint valu
|
|||||||
check_expected(value);
|
check_expected(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_stub_accounts_set_priority_dnd(const char * const account_name, const gint value)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mock_accounts_set_login_presence(const char * const account_name, const char * const value)
|
_mock_accounts_set_login_presence(const char * const account_name, const char * const value)
|
||||||
@ -379,6 +408,16 @@ mock_accounts_set_priorities(void)
|
|||||||
accounts_set_priority_dnd = _mock_accounts_set_priority_dnd;
|
accounts_set_priority_dnd = _mock_accounts_set_priority_dnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stub_accounts_set_priorities(void)
|
||||||
|
{
|
||||||
|
accounts_set_priority_online = _stub_accounts_set_priority_online;
|
||||||
|
accounts_set_priority_chat = _stub_accounts_set_priority_chat;
|
||||||
|
accounts_set_priority_away = _stub_accounts_set_priority_away;
|
||||||
|
accounts_set_priority_xa = _stub_accounts_set_priority_xa;
|
||||||
|
accounts_set_priority_dnd = _stub_accounts_set_priority_dnd;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mock_accounts_set_login_presence(void)
|
mock_accounts_set_login_presence(void)
|
||||||
{
|
{
|
||||||
|
@ -79,6 +79,7 @@ void stub_accounts_set_muc_nick(void);
|
|||||||
void accounts_set_muc_nick_expect(char *account_name, char *nick);
|
void accounts_set_muc_nick_expect(char *account_name, char *nick);
|
||||||
|
|
||||||
void mock_accounts_set_priorities(void);
|
void mock_accounts_set_priorities(void);
|
||||||
|
void stub_accounts_set_priorities(void);
|
||||||
void accounts_set_priority_online_expect(char *account_name, gint priority);
|
void accounts_set_priority_online_expect(char *account_name, gint priority);
|
||||||
void accounts_set_priority_chat_expect(char *account_name, gint priority);
|
void accounts_set_priority_chat_expect(char *account_name, gint priority);
|
||||||
void accounts_set_priority_away_expect(char *account_name, gint priority);
|
void accounts_set_priority_away_expect(char *account_name, gint priority);
|
||||||
|
@ -947,7 +947,27 @@ void cmd_account_set_dnd_priority_sets_preference(void **state)
|
|||||||
free(help);
|
free(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test message shown when set
|
void cmd_account_set_online_priority_shows_message(void **state)
|
||||||
|
{
|
||||||
|
mock_cons_show();
|
||||||
|
mock_accounts_account_exists();
|
||||||
|
stub_accounts_set_priorities();
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
gchar *args[] = { "set", "a_account", "online", "10", NULL };
|
||||||
|
|
||||||
|
accounts_account_exists_return(TRUE);
|
||||||
|
|
||||||
|
mock_connection_status(JABBER_DISCONNECTED);
|
||||||
|
|
||||||
|
expect_cons_show("Updated online priority for account a_account: 10");
|
||||||
|
expect_cons_show("");
|
||||||
|
|
||||||
|
gboolean result = cmd_account(args, *help);
|
||||||
|
assert_true(result);
|
||||||
|
|
||||||
|
free(help);
|
||||||
|
|
||||||
|
}
|
||||||
// test invalid priority low
|
// test invalid priority low
|
||||||
// test invalid priority high
|
// test invalid priority high
|
||||||
// test presence updated when connected as account and current presence equals setting
|
// test presence updated when connected as account and current presence equals setting
|
||||||
|
@ -50,3 +50,4 @@ void cmd_account_set_chat_priority_sets_preference(void **state);
|
|||||||
void cmd_account_set_away_priority_sets_preference(void **state);
|
void cmd_account_set_away_priority_sets_preference(void **state);
|
||||||
void cmd_account_set_xa_priority_sets_preference(void **state);
|
void cmd_account_set_xa_priority_sets_preference(void **state);
|
||||||
void cmd_account_set_dnd_priority_sets_preference(void **state);
|
void cmd_account_set_dnd_priority_sets_preference(void **state);
|
||||||
|
void cmd_account_set_online_priority_shows_message(void **state);
|
||||||
|
@ -241,6 +241,7 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_account_set_away_priority_sets_preference),
|
unit_test(cmd_account_set_away_priority_sets_preference),
|
||||||
unit_test(cmd_account_set_xa_priority_sets_preference),
|
unit_test(cmd_account_set_xa_priority_sets_preference),
|
||||||
unit_test(cmd_account_set_dnd_priority_sets_preference),
|
unit_test(cmd_account_set_dnd_priority_sets_preference),
|
||||||
|
unit_test(cmd_account_set_online_priority_shows_message),
|
||||||
};
|
};
|
||||||
return run_tests(tests);
|
return run_tests(tests);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user