[telepathy-gabble/master] Switch the tests to use the test-resolver.

Mike Ruprecht mike.ruprecht at collabora.co.uk
Mon Dec 7 07:36:11 PST 2009


---
 tests/twisted/Makefile.am  |    5 ++---
 tests/twisted/main-debug.c |   17 +++++++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index d9802ca..0310cfd 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -216,12 +216,11 @@ noinst_PROGRAMS = \
 
 telepathy_gabble_debug_SOURCES = \
     main-debug.c \
-    resolver-fake.c \
-    resolver-fake.h
+    test-resolver.c \
+    test-resolver.h
 
 telepathy_gabble_debug_LDADD = \
     $(top_builddir)/src/libgabble-convenience.la \
-    $(top_builddir)/lib/gibber/libgibber.la \
     $(ALL_LIBS)
 
 AM_CFLAGS = $(ERROR_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@ @WOCKY_CFLAGS@ \
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 1f1d69a..2f4e224 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -30,9 +30,7 @@
 #include <telepathy-glib/dbus.h>
 #include <wocky/wocky.h>
 
-#include <lib/gibber/gibber-resolver.h>
-
-#include "resolver-fake.h"
+#include "test-resolver.h"
 
 static DBusHandlerResult
 dbus_filter_function (DBusConnection *connection,
@@ -57,6 +55,7 @@ main (int argc,
   GError *error = NULL;
   DBusConnection *connection;
   int ret = 1;
+  GResolver *original, *kludged;
 
   gabble_init ();
 
@@ -82,8 +81,18 @@ main (int argc,
   /* needed for test-avatar-async.py */
   gabble_vcard_manager_set_suspend_reply_timeout (3);
   gabble_vcard_manager_set_default_request_timeout (3);
+  
+  /* hook up the fake DNS resolver that lets us divert A and SRV queries *
+   * into our local cache before asking the real DNS                     */
+  original = g_resolver_get_default ();
+  kludged = g_object_new (TEST_TYPE_RESOLVER, "real-resolver", original, NULL);
+  g_resolver_set_default (kludged);
+
+  test_resolver_add_A (TEST_RESOLVER (kludged),
+      "resolves-to-5.4.3.2", "5.4.3.2");
+  test_resolver_add_A (TEST_RESOLVER (kludged),
+      "resolves-to-1.2.3.4", "1.2.3.4");
 
-  gibber_resolver_set_resolver (GABBLE_TYPE_RESOLVER_FAKE);
   gabble_jingle_factory_set_test_mode ();
 
   ret = gabble_main (argc, argv);
-- 
1.5.6.5




More information about the telepathy-commits mailing list