Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
 tests/meson.build    |  1 +
 tests/virgdbusmock.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100644 tests/virgdbusmock.c

diff --git a/tests/meson.build b/tests/meson.build
index f0f3d8c1ef..0f3e4bfdd7 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -57,6 +57,7 @@ mock_libs = [
   { 'name': 'vircgroupmock' },
   { 'name': 'virdeterministichashmock' },
   { 'name': 'virfilecachemock' },
+  { 'name': 'virgdbusmock' },
   { 'name': 'virhostcpumock' },
   { 'name': 'virhostdevmock' },
   { 'name': 'virnetdaemonmock' },
diff --git a/tests/virgdbusmock.c b/tests/virgdbusmock.c
new file mode 100644
index 0000000000..7a378a616a
--- /dev/null
+++ b/tests/virgdbusmock.c
@@ -0,0 +1,85 @@
+/*
+ * virgdbusmock.c: mocking of dbus message send/reply
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include <gio/gio.h>
+
+#include "virmock.h"
+
+VIR_MOCK_STUB_RET_ARGS(g_bus_get_sync,
+                       GDBusConnection *, (GDBusConnection *)0x1,
+                       GBusType, type,
+                       GCancellable, *cancellable,
+                       GError, **error)
+
+VIR_MOCK_STUB_RET_ARGS(g_dbus_address_get_for_bus_sync,
+                       gchar *, (gchar *)0x1,
+                       GBusType, type,
+                       GCancellable *, cancellable,
+                       GError **, error)
+
+VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_new_for_address_sync,
+                       GDBusConnection *, (GDBusConnection *)0x1,
+                       const gchar *, address,
+                       GDBusConnectionFlags, flags,
+                       GDBusAuthObserver *, observer,
+                       GCancellable *, cancellable,
+                       GError **, error)
+
+VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_flush_sync,
+                       gboolean, true,
+                       GDBusConnection *, connection,
+                       GCancellable *, cancellable,
+                       GError **, error)
+
+VIR_MOCK_STUB_RET_ARGS(g_dbus_connection_close_sync,
+                       gboolean, true,
+                       GDBusConnection *, connection,
+                       GCancellable *, cancellable,
+                       GError **, error)
+
+VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_sync,
+                       GVariant *,
+                       GDBusConnection *, connection,
+                       const gchar *, bus_name,
+                       const gchar *, object_path,
+                       const gchar *, interface_name,
+                       const gchar *, method_name,
+                       GVariant *, parameters,
+                       const GVariantType *, reply_type,
+                       GDBusCallFlags, flags,
+                       gint, timeout_msec,
+                       GCancellable *, cancellable,
+                       GError **, error)
+
+VIR_MOCK_LINK_RET_ARGS(g_dbus_connection_call_with_unix_fd_list_sync,
+                       GVariant *,
+                       GDBusConnection *, connection,
+                       const gchar *, bus_name,
+                       const gchar *, object_path,
+                       const gchar *, interface_name,
+                       const gchar *, method_name,
+                       GVariant *, parameters,
+                       const GVariantType *, reply_type,
+                       GDBusCallFlags, flags,
+                       gint, timeout_msec,
+                       GUnixFDList *, fd_list,
+                       GUnixFDList **, out_fd_list,
+                       GCancellable *, cancellable,
+                       GError **, error)
-- 
2.26.2

Reply via email to