diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dbus/test-tpl-log-store-xml.c | 57 | ||||
-rw-r--r-- | tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/derek.foreman@collabora.co.uk/20110210.log | 5 |
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/dbus/test-tpl-log-store-xml.c b/tests/dbus/test-tpl-log-store-xml.c index 548fc26..fa9faf5 100644 --- a/tests/dbus/test-tpl-log-store-xml.c +++ b/tests/dbus/test-tpl-log-store-xml.c @@ -2,6 +2,7 @@ #include "telepathy-logger/log-manager-internal.h" #include "telepathy-logger/log-store-internal.h" +#include "lib/util.h" #include <glib.h> @@ -9,6 +10,7 @@ typedef struct { gchar *tmp_basedir; TplLogStoreXml *store; + TpDBusDaemon *bus; } XmlTestCaseFixture; @@ -39,6 +41,9 @@ setup (XmlTestCaseFixture* fixture, if (fixture->tmp_basedir != NULL) log_store_xml_set_basedir (fixture->store, fixture->tmp_basedir); + + fixture->bus = tp_tests_dbus_daemon_dup_or_die (); + g_assert (fixture->bus != NULL); } @@ -101,6 +106,54 @@ test_clear (XmlTestCaseFixture *fixture, } +static void +test_clear_account (XmlTestCaseFixture *fixture, + gconstpointer user_data) +{ + GList *hits; + TpAccount *account; + GError *error = NULL; + const gchar *kept = "1263405203"; + const gchar *cleared = "f95e605a3ae97c463b626a3538567bc90fc58730"; + + hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store), + kept); + + g_assert_cmpint (g_list_length (hits), ==, 1); + + tpl_log_manager_search_free (hits); + + hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store), + cleared); + + g_assert_cmpint (g_list_length (hits), ==, 1); + + tpl_log_manager_search_free (hits); + + account = tp_account_new (fixture->bus, + TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/test2_40collabora_2eco_2euk0", + &error); + + g_assert_no_error (error); + g_assert (account != NULL); + + _tpl_log_store_clear_account (TPL_LOG_STORE (fixture->store), account); + g_object_unref (account); + + hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store), + kept); + + g_assert_cmpint (g_list_length (hits), ==, 1); + + tpl_log_manager_search_free (hits); + + hits = _tpl_log_store_search_new (TPL_LOG_STORE (fixture->store), + cleared); + + g_assert_cmpint (g_list_length (hits), ==, 0); +} + + gint main (gint argc, gchar **argv) { g_type_init (); @@ -112,5 +165,9 @@ gint main (gint argc, gchar **argv) XmlTestCaseFixture, NULL, setup_for_writing, test_clear, teardown); + g_test_add ("/log-store-xml/clear-account", + XmlTestCaseFixture, NULL, + setup_for_writing, test_clear_account, teardown); + return g_test_run (); } diff --git a/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/derek.foreman@collabora.co.uk/20110210.log b/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/derek.foreman@collabora.co.uk/20110210.log new file mode 100644 index 0000000..aa63a58 --- /dev/null +++ b/tests/logs/TpLogger/logs/gabble_jabber_test2_40collabora_2eco_2euk0/derek.foreman@collabora.co.uk/20110210.log @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='utf-8'?> +<?xml-stylesheet type="text/xsl" href="log-store-xml.xsl"?> +<log> +<message time='20110210T11:21:01' cm_id='f95e605a3ae97c463b626a3538567bc90fc58730' id='test2@test.collabora.co.uk' name='test2@test.collabora.co.uk' token='' isuser='true' type='normal'>Hey, Just generating logs, don't bother replying ;)</message> +</log> |