[folks] tests: Clean up EDS backend testing library API
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] tests: Clean up EDS backend testing library API
- Date: Mon, 9 Mar 2015 16:21:37 +0000 (UTC)
commit 1fd8dbb86c0435f8f0926cf8e2f6ced9f503b931
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Mar 9 16:13:45 2015 +0000
tests: Clean up EDS backend testing library API
The address book name should be a construction time parameter, not a
setup parameter.
This introduces no functional changes.
tests/eds/enable-disable-stores.vala | 4 ++--
tests/eds/link-personas-diff-stores.vala | 9 +++++----
tests/lib/eds/backend.vala | 8 +++-----
tests/lib/eds/test-case.vala | 5 +++--
4 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/tests/eds/enable-disable-stores.vala b/tests/eds/enable-disable-stores.vala
index 92122b2..1812413 100644
--- a/tests/eds/enable-disable-stores.vala
+++ b/tests/eds/enable-disable-stores.vala
@@ -48,8 +48,8 @@ public class EnableDisableStoresTests : EdsTest.TestCase
this._n_stores_prepared = 0;
this._backend_store = BackendStore.dup();
- this._eds_backend_other = new EdsTest.Backend ();
- this._eds_backend_other.set_up (false, "other");
+ this._eds_backend_other = new EdsTest.Backend ("other");
+ this._eds_backend_other.set_up (false);
/* We configure eds as the primary store */
Environment.set_variable ("FOLKS_BACKEND_EDS_USE_ADDRESS_BOOKS",
diff --git a/tests/eds/link-personas-diff-stores.vala b/tests/eds/link-personas-diff-stores.vala
index fa781ef..790ef2c 100644
--- a/tests/eds/link-personas-diff-stores.vala
+++ b/tests/eds/link-personas-diff-stores.vala
@@ -42,11 +42,12 @@ public class LinkPersonasDiffStoresTests : EdsTest.TestCase
this.test_linking_via_local_ids_diff_stores);
}
- public override void set_up ()
+ public override void create_backend ()
{
- base.set_up ();
- this._eds_backend_other = new EdsTest.Backend ();
- this._eds_backend_other.set_up (false, "other");
+ base.create_backend ();
+
+ this._eds_backend_other = new EdsTest.Backend ("other");
+ this._eds_backend_other.set_up (false);
Environment.set_variable ("FOLKS_BACKEND_EDS_USE_ADDRESS_BOOKS",
(this.eds_backend.address_book_uid + ":" +
diff --git a/tests/lib/eds/backend.vala b/tests/lib/eds/backend.vala
index 8a1080c..a39e59e 100644
--- a/tests/lib/eds/backend.vala
+++ b/tests/lib/eds/backend.vala
@@ -50,10 +50,11 @@ public class EdsTest.Backend
get { return this._addressbook.get_source ().get_uid (); }
}
- public Backend ()
+ public Backend (string name = "test")
{
this._contacts = new GLib.List<Gee.HashMap<string, Value?>> ();
this._e_contacts = new string[0];
+ this._addressbook_name = name;
}
public void add_contact (owned Gee.HashMap<string, Value?> c)
@@ -100,13 +101,10 @@ public class EdsTest.Backend
}
/* Create a temporary addressbook */
- public void set_up (bool source_is_default = false, string name = "test")
+ public void set_up (bool source_is_default = false)
{
try
{
- /* _addressbook_name needs to be set before calling _prepare_source */
- this._addressbook_name = name;
-
this._prepare_source (source_is_default);
this._addressbook = BookClient.connect_sync (this._source, 1, null);
Environment.set_variable ("FOLKS_BACKEND_EDS_USE_ADDRESS_BOOKS",
diff --git a/tests/lib/eds/test-case.vala b/tests/lib/eds/test-case.vala
index e5c75b3..068c7bf 100644
--- a/tests/lib/eds/test-case.vala
+++ b/tests/lib/eds/test-case.vala
@@ -193,8 +193,9 @@ public class EdsTest.TestCase : Folks.TestCase
public virtual void create_backend ()
{
/* Use a unique EDS book for each test. */
- this.eds_backend = new EdsTest.Backend ();
- ((!) this.eds_backend).set_up (true, "test%u".printf (this._test_num++));
+ this.eds_backend =
+ new EdsTest.Backend ("test%u".printf (this._test_num++));
+ ((!) this.eds_backend).set_up (true);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]