tests: Fix test suite

Introduce a new GcalStubCalendar class that essentially
removes the ECalClient initialization from GcalCalendar,
and use it as part of a new private library consumed by
the tests.
This commit is contained in:
Georges Basile Stavracas Neto
2019-05-04 12:05:39 -03:00
parent 28c5a41639
commit 7811b90730
4 changed files with 137 additions and 13 deletions
+5 -4
View File
@@ -18,8 +18,9 @@
#include <glib.h>
#include "utils/gcal-utils.h"
#include "gcal-event.h"
#include "gcal-stub-calendar.h"
#include "gcal-utils.h"
#define STUB_EVENT "BEGIN:VEVENT\n" \
"SUMMARY:Stub event\n" \
@@ -55,12 +56,12 @@ create_event_for_string (const gchar *string,
GError **error)
{
g_autoptr (ECalComponent) component = NULL;
g_autoptr (ESource) source = NULL;
g_autoptr (GcalCalendar) calendar = NULL;
source = e_source_new_with_uid ("stub", NULL, error);
component = e_cal_component_new_from_string (string);
calendar = gcal_stub_calendar_new (NULL, error);
return component ? gcal_event_new (source, component, error) : NULL;
return component ? gcal_event_new (calendar, component, error) : NULL;
}