1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-06 03:25:31 +00:00

sip: do not auto load accounts when running tests

because `calls_sip_provider_load_accounts ()` looks at the home folder
for a configuration file.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-03-16 17:56:26 +01:00
parent 19e7f8f119
commit 840ffa4653

View file

@ -63,12 +63,23 @@ static GParamSpec *props[PROP_LAST_PROP];
static void calls_sip_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
#ifdef FOR_TESTING
G_DEFINE_TYPE_WITH_CODE
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init))
#else
G_DEFINE_DYNAMIC_TYPE_EXTENDED
(CallsSipProvider, calls_sip_provider, CALLS_TYPE_PROVIDER, 0,
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
calls_sip_provider_message_source_interface_init));
#endif /* FOR_TESTING */
static gboolean
check_required_keys (GKeyFile *key_file,
const gchar *group_name)
@ -304,9 +315,16 @@ calls_sip_provider_constructed (GObject *object)
{
CallsSipProvider *self = CALLS_SIP_PROVIDER (object);
g_autoptr (GError) error = NULL;
gboolean auto_load_accounts = TRUE;
if (calls_sip_provider_init_sofia (self, &error))
calls_sip_provider_load_accounts (self);
#ifdef FOR_TESTING
auto_load_accounts = FALSE;
#endif
if (calls_sip_provider_init_sofia (self, &error)) {
if (auto_load_accounts)
calls_sip_provider_load_accounts (self);
}
else
g_warning ("Could not initalize sofia stack: %s", error->message);