summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-05-16 02:07:04 -0700
committerPatrick Ohly <patrick.ohly@intel.com>2013-05-16 11:25:05 +0200
commitef52bf13795ab82530c279f626daaebbbdb59431 (patch)
tree30a133f216b9dae99d65fae49c48b49d49662ba9
parent11224d2df09658c18aba3a71bd84ae314234f715 (diff)
PIM testing: fix TestContacts.testDeadAgent
Sometimes an extra "quiescent" signal was seen. It came from the FolksAggregator before reporting any contacts. Not exactly sure why that happens, but because it is not the responsibility of this test to detect that, let's ignore it here.
-rwxr-xr-xsrc/dbus/server/pim/testpim.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/dbus/server/pim/testpim.py b/src/dbus/server/pim/testpim.py
index 143acb56..e3b5d016 100755
--- a/src/dbus/server/pim/testpim.py
+++ b/src/dbus/server/pim/testpim.py
@@ -3660,9 +3660,6 @@ END:VCARD''']):
self.setUpView(search=None, peers=[], withSystemAddressBook=True)
# Insert new contact.
- #
- # The names are chosen so that sorting by first name and sorting by last name needs to
- # reverse the list.
for i, contact in enumerate([u'''BEGIN:VCARD
VERSION:3.0
FN:John Doe
@@ -3677,19 +3674,31 @@ END:VCARD''',
out, err, returncode = self.runCmdline(['--import', self.contacts, 'backend=evolution-contacts'])
- # Plug into "ContactsAdded" method so that it throws an error.
+ # Plug into processEvent() method so that it throws an error
+ # when receiving the ContactsAdded method call. The same cannot be
+ # done for Quiescent, because that call is optional and thus allowed
+ # to fail.
original = self.view.processEvent
def intercept(message, event):
+ if event[0] == 'quiescent':
+ # Sometimes the aggregator was seen as idle before
+ # it loaded the item above, leading to one
+ # additional 'quiescent' before 'added'. Not sure
+ # why. Anyway, that belongs into a different test,
+ # so ignore 'quiescent' here.
+ return
+ # Record it.
original(message, event)
+ # Raise error?
if event[0] == 'added':
+ logging.printf('raising "fake error" for event %s' % event)
raise Exception('fake error')
self.view.processEvent = intercept
self.view.search([])
self.runUntil('phone results',
check=lambda: self.assertEqual([], self.view.errors),
- until=lambda: self.view.quiescentCount > 0)
- self.assertEqual([('added', 0, 1),
- ('quiescent',)],
+ until=lambda: self.view.events)
+ self.assertEqual([('added', 0, 1)],
self.view.events)
# Expect an error, view should have been closed already.