[folks] Add backend state key files for most tests.



commit c38d4b7797321a484ff11c254c587ffeb1c92174
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Mon Nov 1 12:01:40 2010 -0700

    Add backend state key files for most tests.
    
    Only Folks-core tests are concerned with specifically testing the Backend
    enabling/disabling code (which is bulkier than out-of-sight settings files).

 tests/data/backend-store-all.ini                   |    5 +++
 tests/folks/Makefile.am                            |    5 +++
 tests/key-file/Makefile.am                         |    5 +++
 .../key-file/data/backend-store-key-file-only.ini  |    5 +++
 tests/key-file/individual-retrieval.vala           |   31 --------------------
 tests/telepathy/Makefile.am                        |    2 +
 .../data/backend-store-telepathy-only.ini          |    5 +++
 tests/telepathy/individual-retrieval.vala          |   16 ----------
 8 files changed, 27 insertions(+), 47 deletions(-)
---
diff --git a/tests/data/backend-store-all.ini b/tests/data/backend-store-all.ini
new file mode 100644
index 0000000..42e8fb5
--- /dev/null
+++ b/tests/data/backend-store-all.ini
@@ -0,0 +1,5 @@
+[key-file]
+enabled=true
+
+[telepathy]
+enabled=true
diff --git a/tests/folks/Makefile.am b/tests/folks/Makefile.am
index 60e7ab3..27f821a 100644
--- a/tests/folks/Makefile.am
+++ b/tests/folks/Makefile.am
@@ -30,6 +30,11 @@ noinst_PROGRAMS = \
 	backend-loading \
 	$(NULL)
 
+backend_store_key_file=$(top_srcdir)/tests/data/backend-store-all.ini
+TESTS_ENVIRONMENT = \
+	FOLKS_BACKEND_STORE_KEY_FILE_PATH=$(backend_store_key_file) \
+	$(NULL)
+
 TESTS = $(noinst_PROGRAMS)
 
 backend_loading_SOURCES = \
diff --git a/tests/key-file/Makefile.am b/tests/key-file/Makefile.am
index 1df71cb..7b9397f 100644
--- a/tests/key-file/Makefile.am
+++ b/tests/key-file/Makefile.am
@@ -33,6 +33,11 @@ noinst_PROGRAMS = \
 	individual-retrieval \
 	$(NULL)
 
+backend_store_key_file=$(srcdir)/data/backend-store-key-file-only.ini
+TESTS_ENVIRONMENT = \
+        FOLKS_BACKEND_STORE_KEY_FILE_PATH=$(backend_store_key_file) \
+        $(NULL)
+
 TESTS = $(noinst_PROGRAMS)
 
 individual_retrieval_SOURCES = \
diff --git a/tests/key-file/data/backend-store-key-file-only.ini b/tests/key-file/data/backend-store-key-file-only.ini
new file mode 100644
index 0000000..3ca88dc
--- /dev/null
+++ b/tests/key-file/data/backend-store-key-file-only.ini
@@ -0,0 +1,5 @@
+[key-file]
+enabled=true
+
+[telepathy]
+enabled=false
diff --git a/tests/key-file/individual-retrieval.vala b/tests/key-file/individual-retrieval.vala
index 873b226..3994222 100644
--- a/tests/key-file/individual-retrieval.vala
+++ b/tests/key-file/individual-retrieval.vala
@@ -5,8 +5,6 @@ using KfTest;
 public class IndividualRetrievalTests : Folks.TestCase
 {
   private KfTest.Backend kf_backend;
-  private MainLoop main_loop;
-  private static const string STORE_FILE_PATH = "folks-key-file-store.ini";
 
   public IndividualRetrievalTests ()
     {
@@ -20,39 +18,10 @@ public class IndividualRetrievalTests : Folks.TestCase
 
   public override void set_up ()
     {
-      this.main_loop = new GLib.MainLoop (null, false);
-
-      FileUtils.remove (Path.build_filename (Environment.get_tmp_dir (),
-          this.STORE_FILE_PATH, null));
-
-      /* Use a temporary key file for the BackendStore */
-      Environment.set_variable ("FOLKS_BACKEND_STORE_KEY_FILE_PATH",
-          Path.build_filename (Environment.get_tmp_dir (),
-              this.STORE_FILE_PATH, null), true);
-
-      /* Disable the Telepathy backend so it doesn't interfere with the tests */
-      BackendStore store = BackendStore.dup ();
-      store.prepare.begin ((o, r) =>
-        {
-          store.prepare.end (r);
-          store.disable_backend.begin ("telepathy");
-        });
     }
 
   public override void tear_down ()
     {
-      FileUtils.remove (Path.build_filename (Environment.get_tmp_dir (),
-          this.STORE_FILE_PATH, null));
-
-      Timeout.add_seconds (5, () =>
-        {
-          this.main_loop.quit ();
-          this.main_loop = null;
-          return false;
-        });
-
-      /* Run the main loop to process the carnage and destruction */
-      this.main_loop.run ();
     }
 
   public void test_singleton_individuals ()
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index 75d1c31..611e0c9 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -49,8 +49,10 @@ noinst_PROGRAMS = \
 	$(NULL)
 
 SESSION_CONF = $(top_builddir)/tests/lib/telepathy/contactlist/session.conf
+backend_store_key_file=$(srcdir)/data/backend-store-telepathy-only.ini
 TESTS_ENVIRONMENT = \
 	FOLKS_BACKEND_KEY_FILE_PATH=$(srcdir)/data/relationships-empty.ini \
+	FOLKS_BACKEND_STORE_KEY_FILE_PATH=$(backend_store_key_file) \
 	$(RUN_WITH_PRIVATE_BUS) \
 	--config-file=$(SESSION_CONF) \
 	--
diff --git a/tests/telepathy/data/backend-store-telepathy-only.ini b/tests/telepathy/data/backend-store-telepathy-only.ini
new file mode 100644
index 0000000..1a47b83
--- /dev/null
+++ b/tests/telepathy/data/backend-store-telepathy-only.ini
@@ -0,0 +1,5 @@
+[key-file]
+enabled=false
+
+[telepathy]
+enabled=true
diff --git a/tests/telepathy/individual-retrieval.vala b/tests/telepathy/individual-retrieval.vala
index 8b7ecd7..a644608 100644
--- a/tests/telepathy/individual-retrieval.vala
+++ b/tests/telepathy/individual-retrieval.vala
@@ -36,22 +36,6 @@ public class IndividualRetrievalTests : Folks.TestCase
 
   public override void set_up ()
     {
-      /* Disable the key-file backend so it doesn't interfere with the tests */
-      BackendStore store = BackendStore.dup ();
-      store.prepare.begin ((o, r) =>
-        {
-          store.prepare.end (r);
-          store.disable_backend.begin ("key-file");
-        });
-
-      /* Disable the key-file backend so it doesn't interfere with the tests */
-      BackendStore store = BackendStore.dup ();
-      store.prepare.begin ((o, r) =>
-        {
-          store.prepare.end (r);
-          store.disable_backend.begin ("key-file");
-        });
-
       this.tp_backend.set_up ();
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]