~rodrigo-moya/ubuntuone-client/contact-default-icon

« back to all changes in this revision

Viewing changes to contrib/testing/testcase.py

Remove the watch when a directory is deleted

Show diffs side-by-side

added added

removed removed

Lines of Context:
452
452
        """ Just add the record to self.records. """
453
453
        self.records.append(record)
454
454
 
 
455
    def check(self, level, *msgs):
 
456
        """Verifies that the msgs are logged in the specified level."""
 
457
        for rec in self.records:
 
458
            if rec.levelno == level and all(m in rec.message for m in msgs):
 
459
                return True
 
460
        return False
 
461
 
 
462
    def check_debug(self, *msgs):
 
463
        """Shortcut for checking in DEBUG."""
 
464
        return self.check(logging.DEBUG, *msgs)
 
465
 
 
466
    def check_info(self, *msgs):
 
467
        """Shortcut for checking in INFO."""
 
468
        return self.check(logging.INFO, *msgs)
 
469
 
 
470
    def check_warning(self, *msgs):
 
471
        """Shortcut for checking in WARNING."""
 
472
        return self.check(logging.WARNING, *msgs)
 
473
 
 
474
    def check_error(self, *msgs):
 
475
        """Shortcut for checking in ERROR."""
 
476
        return self.check(logging.ERROR, *msgs)
 
477
 
455
478
 
456
479
class FakeNetworkManager(DBusExposedObject):
457
480
    """ A fake NetworkManager that only emits StatusChanged signal. """