[folks] tests: Fix the EDS link-personas-diff-stores test



commit 07bd131884ce4ae7d6e1fa9bf777da38b82b1a46
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Jan 6 14:37:28 2012 +0000

    tests: Fix the EDS link-personas-diff-stores test
    
    Due to the tightening up of checks for PersonaStores being prepared before
    PersonaStore.add_persona_from_details() is called, this test was failing
    because it didnât wait for its persona stores to get prepared.
    
    This fixes the problem by waiting for quiescence before launching into the
    test code proper.

 tests/eds/link-personas-diff-stores.vala |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/tests/eds/link-personas-diff-stores.vala b/tests/eds/link-personas-diff-stores.vala
index 2d216b1..39fde70 100644
--- a/tests/eds/link-personas-diff-stores.vala
+++ b/tests/eds/link-personas-diff-stores.vala
@@ -106,16 +106,24 @@ public class LinkPersonasDiffStoresTests : Folks.TestCase
       try
         {
           yield this._aggregator.prepare ();
+          assert (this._aggregator.is_prepared);
 
-          var pstore = this._get_store (store,
-              this._eds_backend.address_book_uid);
-          assert (pstore != null);
-
-          var pstore2 = this._get_store (store,
-              this._eds_backend_other.address_book_uid);
-          assert (pstore2 != null);
-
-          yield this._add_personas (pstore, pstore2);
+          /* We require both stores to guarantee to be prepared for this test,
+           * since we call add_persona_from_details() on them. */
+          this._aggregator.notify["is-quiescent"].connect ((obj, pspec) =>
+            {
+              var pstore = this._get_store (store,
+                  this._eds_backend.address_book_uid);
+              assert (pstore != null);
+              assert (pstore.is_prepared == true);
+
+              var pstore2 = this._get_store (store,
+                  this._eds_backend_other.address_book_uid);
+              assert (pstore2 != null);
+              assert (pstore2.is_prepared == true);
+
+              this._add_personas (pstore, pstore2);
+            });
         }
       catch (GLib.Error e)
         {



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