telepathy-logger: tests/dbus/test-tpl-log-iters-xml: use tpl_test_create_and_prepare_account()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Fri Sep 27 04:44:19 PDT 2013


Module: telepathy-logger
Branch: master
Commit: 8b81467bea6759f9ef0beb092e6cd02a50000840
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=8b81467bea6759f9ef0beb092e6cd02a50000840

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Thu Sep 26 16:55:12 2013 +0200

tests/dbus/test-tpl-log-iters-xml: use tpl_test_create_and_prepare_account()

This test will rely on the TpAccount to be prepared soon.

https://bugs.freedesktop.org/show_bug.cgi?id=69814

---

 tests/dbus/test-tpl-log-iter-xml.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/tests/dbus/test-tpl-log-iter-xml.c b/tests/dbus/test-tpl-log-iter-xml.c
index 044bf47..95285f1 100644
--- a/tests/dbus/test-tpl-log-iter-xml.c
+++ b/tests/dbus/test-tpl-log-iter-xml.c
@@ -1,5 +1,6 @@
 #include "config.h"
 
+#include "lib/logger-test-helper.h"
 #include "lib/util.h"
 
 #include "telepathy-logger/call-event.h"
@@ -17,10 +18,12 @@
 
 typedef struct
 {
+  GMainLoop *main_loop;
   TplLogStore *store;
   TpAccount *account;
   TpDBusDaemon *bus;
   TpSimpleClientFactory *factory;
+  TpTestsSimpleAccount *account_service;
 } XmlTestCaseFixture;
 
 
@@ -30,6 +33,8 @@ setup (XmlTestCaseFixture* fixture,
 {
   GError *error = NULL;
 
+  fixture->main_loop = g_main_loop_new (NULL, FALSE);
+
   fixture->store = g_object_new (TPL_TYPE_LOG_STORE_XML,
       "testmode", TRUE,
       NULL);
@@ -37,16 +42,18 @@ setup (XmlTestCaseFixture* fixture,
   fixture->bus = tp_tests_dbus_daemon_dup_or_die ();
   g_assert (fixture->bus != NULL);
 
+  tp_dbus_daemon_request_name (fixture->bus,
+      TP_ACCOUNT_MANAGER_BUS_NAME,
+      FALSE,
+      &error);
+  g_assert_no_error (error);
+
   fixture->factory = tp_simple_client_factory_new (fixture->bus);
   g_assert (fixture->factory != NULL);
 
-  /* We can get away without preparing the account */
-  fixture->account = tp_simple_client_factory_ensure_account (fixture->factory,
+  tpl_test_create_and_prepare_account (fixture->bus, fixture->factory,
       TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk",
-      NULL,
-      &error);
-  g_assert_no_error (error);
-  g_assert (fixture->account != NULL);
+      &fixture->account, &fixture->account_service);
 
   tp_debug_divert_messages (g_getenv ("TPL_LOGFILE"));
 
@@ -60,7 +67,15 @@ static void
 teardown (XmlTestCaseFixture *fixture,
     gconstpointer user_data)
 {
-  g_clear_object (&fixture->account);
+  GError *error = NULL;
+
+  tp_dbus_daemon_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME,
+      &error);
+  g_assert_no_error (error);
+
+  tpl_test_release_account  (fixture->bus, fixture->account,
+      fixture->account_service);
+
   g_clear_object (&fixture->factory);
   g_clear_object (&fixture->bus);
   g_clear_object (&fixture->store);



More information about the telepathy-commits mailing list