diff options
| author | James Booth <boothj5@gmail.com> | 2014-05-10 00:50:43 +0100 |
|---|---|---|
| committer | James Booth <boothj5@gmail.com> | 2014-05-10 00:50:43 +0100 |
| commit | d2662a6f174402a045bf400a4659e7fc9155cc34 (patch) | |
| tree | 17dd692669e514d47d71f0cb73ddebf5f922c47e /tests/xmpp | |
| parent | a519d25e4bc7eeca1c53ba3200157ae69003f30a (diff) | |
| download | profani-tty-d2662a6f174402a045bf400a4659e7fc9155cc34.tar.gz | |
Refactored bookmarks to use option parser, allow bookmarking rooms with passwords
Diffstat (limited to 'tests/xmpp')
| -rw-r--r-- | tests/xmpp/mock_xmpp.c | 25 | ||||
| -rw-r--r-- | tests/xmpp/mock_xmpp.h | 5 |
2 files changed, 18 insertions, 12 deletions
diff --git a/tests/xmpp/mock_xmpp.c b/tests/xmpp/mock_xmpp.c index c2ded651..7faf7170 100644 --- a/tests/xmpp/mock_xmpp.c +++ b/tests/xmpp/mock_xmpp.c @@ -65,19 +65,19 @@ _mock_bookmark_get_list(void) } static gboolean -_mock_bookmark_add(const char *jid, const char *nick, gboolean autojoin) +_mock_bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str) { check_expected(jid); check_expected(nick); - check_expected(autojoin); + check_expected(password); + check_expected(autojoin_str); return (gboolean)mock(); } static gboolean -_mock_bookmark_remove(const char *jid, gboolean autojoin) +_mock_bookmark_remove(const char *jid) { check_expected(jid); - check_expected(autojoin); return (gboolean)mock(); } @@ -258,7 +258,7 @@ presence_update_expect(resource_presence_t presence, char *msg, int idle) void expect_and_return_bookmark_add(char *expected_jid, char *expected_nick, - gboolean expected_autojoin, gboolean added) + const char *expected_password, const char *expected_autojoin_str, gboolean added) { expect_string(_mock_bookmark_add, jid, expected_jid); if (expected_nick != NULL) { @@ -266,17 +266,24 @@ expect_and_return_bookmark_add(char *expected_jid, char *expected_nick, } else { expect_value(_mock_bookmark_add, nick, NULL); } - expect_value(_mock_bookmark_add, autojoin, expected_autojoin); + if (expected_password != NULL) { + expect_string(_mock_bookmark_add, password, expected_password); + } else { + expect_value(_mock_bookmark_add, password, NULL); + } + if (expected_autojoin_str != NULL) { + expect_string(_mock_bookmark_add, autojoin_str, expected_autojoin_str); + } else { + expect_value(_mock_bookmark_add, autojoin_str, NULL); + } will_return(_mock_bookmark_add, added); } void -expect_and_return_bookmark_remove(char *expected_jid, gboolean expected_autojoin, - gboolean removed) +expect_and_return_bookmark_remove(char *expected_jid, gboolean removed) { expect_string(_mock_bookmark_remove, jid, expected_jid); - expect_value(_mock_bookmark_remove, autojoin, expected_autojoin); will_return(_mock_bookmark_remove, removed); } diff --git a/tests/xmpp/mock_xmpp.h b/tests/xmpp/mock_xmpp.h index a5f93fd2..ed742971 100644 --- a/tests/xmpp/mock_xmpp.h +++ b/tests/xmpp/mock_xmpp.h @@ -25,11 +25,10 @@ void bookmark_get_list_returns(GList *bookmarks); void mock_bookmark_add(void); void expect_and_return_bookmark_add(char *expected_jid, char *expected_nick, - gboolean expected_autojoin, gboolean added); + char *expected_password, char *expected_autojoin_str, gboolean added); void mock_bookmark_remove(void); -void expect_and_return_bookmark_remove(char *expected_jid, gboolean expected_autojoin, - gboolean removed); +void expect_and_return_bookmark_remove(char *expected_jid, gboolean removed); void message_send_expect(char *message, char *recipient); |