tests: Fix the EDS link-personas-diff-stores test
authorPhilip Withnall <philip@tecnocode.co.uk>
Fri, 6 Jan 2012 14:37:28 +0000 (14:37 +0000)
committerPhilip Withnall <philip@tecnocode.co.uk>
Fri, 6 Jan 2012 18:48:35 +0000 (18:48 +0000)
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

index 2d216b1..39fde70 100644 (file)
@@ -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)
         {