summaryrefslogtreecommitdiff
path: root/libnm-glib/tests
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-06-20 10:19:37 -0400
committerDan Winship <danw@gnome.org>2014-07-15 09:44:55 -0400
commit3aad3124f13dd0800cfd52dd88ac44b29d026bab (patch)
tree843b21b4a53325ddb98180c5ef80421234b28c79 /libnm-glib/tests
parent2570c5a17ceab3eb39695493b07144cba04eadbf (diff)
downloadNetworkManager-3aad3124f13dd0800cfd52dd88ac44b29d026bab.tar.gz
libnm-glib: drop separate test library
Previously, we built a second copy of libnm-glib that was hacked to use the session bus rather than the system bus, for use by the test programs. Rather than doing that, just have test-nm-client explicitly override the choice of bus. (test-remote-settings-client was actually already doing this, although it leaked the bus after.)
Diffstat (limited to 'libnm-glib/tests')
-rw-r--r--libnm-glib/tests/Makefile.am4
-rw-r--r--libnm-glib/tests/test-nm-client.c13
-rw-r--r--libnm-glib/tests/test-remote-settings-client.c1
3 files changed, 15 insertions, 3 deletions
diff --git a/libnm-glib/tests/Makefile.am b/libnm-glib/tests/Makefile.am
index 38f449ac1a..b287147bcc 100644
--- a/libnm-glib/tests/Makefile.am
+++ b/libnm-glib/tests/Makefile.am
@@ -19,7 +19,7 @@ test_nm_client_SOURCES = \
test_nm_client_LDADD = \
$(top_builddir)/libnm-util/libnm-util.la \
- $(top_builddir)/libnm-glib/libnm-glib-test.la \
+ $(top_builddir)/libnm-glib/libnm-glib.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
@@ -30,7 +30,7 @@ test_remote_settings_client_SOURCES = \
test_remote_settings_client_LDADD = \
$(top_builddir)/libnm-util/libnm-util.la \
- $(top_builddir)/libnm-glib/libnm-glib-test.la \
+ $(top_builddir)/libnm-glib/libnm-glib.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
diff --git a/libnm-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c
index 36c921ae98..572e1fdc6b 100644
--- a/libnm-glib/tests/test-nm-client.c
+++ b/libnm-glib/tests/test-nm-client.c
@@ -127,6 +127,7 @@ name_exists (GDBusConnection *c, const char *name)
static ServiceInfo *
service_init (void)
{
+ DBusGConnection *bus;
ServiceInfo *sinfo;
const char *args[2] = { fake_exec, NULL };
GError *error = NULL;
@@ -165,9 +166,19 @@ service_init (void)
NULL, NULL);
test_assert (sinfo->proxy);
- sinfo->client = nm_client_new ();
+ bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ g_assert_no_error (error);
+
+ sinfo->client = g_object_new (NM_TYPE_CLIENT,
+ NM_OBJECT_DBUS_CONNECTION, bus,
+ NM_OBJECT_DBUS_PATH, NM_DBUS_PATH,
+ NULL);
test_assert (sinfo->client != NULL);
+ dbus_g_connection_unref (bus);
+ g_initable_init (G_INITABLE (sinfo->client), NULL, &error);
+ g_assert_no_error (error);
+
return sinfo;
}
diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c
index 0114f20048..d92583a112 100644
--- a/libnm-glib/tests/test-remote-settings-client.c
+++ b/libnm-glib/tests/test-remote-settings-client.c
@@ -392,6 +392,7 @@ main (int argc, char **argv)
ret = g_test_run ();
cleanup ();
+ dbus_g_connection_unref (bus);
return ret;
}