tests: Add a way to get the mock session bus address in tests

This is better than using `g_getenv ("DBUS_SESSION_BUS_ADDRESS")` as it
will fail more explicitly if the mock bus somehow isn’t running.

This will be used in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-09-27 17:06:47 +01:00
parent 019de2cbbc
commit d7bb4664e7
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73
2 changed files with 8 additions and 0 deletions

View File

@ -71,3 +71,10 @@ session_bus_run (void)
return ret; return ret;
} }
const char *
session_bus_get_address (void)
{
g_assert (singleton != NULL);
return g_test_dbus_get_bus_address (singleton);
}

View File

@ -31,6 +31,7 @@ void session_bus_up (void);
void session_bus_stop (void); void session_bus_stop (void);
void session_bus_down (void); void session_bus_down (void);
gint session_bus_run (void); gint session_bus_run (void);
const char *session_bus_get_address (void);
G_END_DECLS G_END_DECLS