[folks] Disable unused backends in the tests.



commit 145d13ad7320affbdc5f8c201c75251f8cd6c6ac
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Sep 16 17:46:32 2010 +0100

    Disable unused backends in the tests.
    
    Helps bgo#629862.

 tests/key-file/individual-retrieval.vala  |   20 ++++++++++++++++++++
 tests/telepathy/individual-retrieval.vala |    8 ++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/tests/key-file/individual-retrieval.vala b/tests/key-file/individual-retrieval.vala
index 1776366..873b226 100644
--- a/tests/key-file/individual-retrieval.vala
+++ b/tests/key-file/individual-retrieval.vala
@@ -6,6 +6,7 @@ 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,10 +21,29 @@ 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 ();
diff --git a/tests/telepathy/individual-retrieval.vala b/tests/telepathy/individual-retrieval.vala
index 9dcae66..8b7ecd7 100644
--- a/tests/telepathy/individual-retrieval.vala
+++ b/tests/telepathy/individual-retrieval.vala
@@ -44,6 +44,14 @@ public class IndividualRetrievalTests : Folks.TestCase
           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]