[folks] Ensure we are only testing the built-in backends



commit dd1d8fcf30ddbe86f557397b4829660daf94ed9d
Author: Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
Date:   Sun Mar 20 22:57:46 2011 +0000

    Ensure we are only testing the built-in backends

 tests/data/backend-store-all.ini |    9 ++++++++-
 tests/folks/backend-loading.vala |   30 +++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/tests/data/backend-store-all.ini b/tests/data/backend-store-all.ini
index 7c61234..a24f714 100644
--- a/tests/data/backend-store-all.ini
+++ b/tests/data/backend-store-all.ini
@@ -1,2 +1,9 @@
-[all-others]
+
+[key-file]
+enabled=true
+
+[telepathy]
 enabled=true
+
+[all-others]
+enabled=false
diff --git a/tests/folks/backend-loading.vala b/tests/folks/backend-loading.vala
index 23a3f29..3fd9adb 100644
--- a/tests/folks/backend-loading.vala
+++ b/tests/folks/backend-loading.vala
@@ -25,13 +25,33 @@ public class BackendLoadingTests : Folks.TestCase
       this._account_handle = this._tp_backend.add_account ("protocol",
           "me example com", "cm", "account");
 
-      FileUtils.remove (Path.build_filename (Environment.get_tmp_dir (),
-          this.STORE_FILE_PATH, null));
-
       /* Use a temporary key file for the BackendStore */
+      var kf_path = Path.build_filename (Environment.get_tmp_dir (),
+          this.STORE_FILE_PATH, null);
+
+      FileUtils.remove (kf_path);
+
+      GLib.KeyFile kf = new GLib.KeyFile ();
+      kf.set_boolean("all-others", "enabled", false);
+      kf.set_boolean("telepathy", "enabled", true);
+      kf.set_boolean("key-file", "enabled", true);
+
+      try
+        {
+          File backend_f = File.new_for_path (kf_path);
+          string data = kf.to_data ();
+          backend_f.replace_contents (data,
+              data.length, null, false, FileCreateFlags.PRIVATE,
+              null);
+        }
+      catch (Error e)
+        {
+          warning ("Could not write updated backend key file '%s': %s",
+              kf_path, e.message);
+        }
+
       Environment.set_variable ("FOLKS_BACKEND_STORE_KEY_FILE_PATH",
-          Path.build_filename (Environment.get_tmp_dir (),
-              this.STORE_FILE_PATH, null), true);
+          kf_path, true);
     }
 
   public override void tear_down ()



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