~fboucault/moovida/relook

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/pigment/tests/test_pigment_frontend.py

  • Committer: Philippe Normand
  • Date: 2009-06-23 14:57:45 UTC
  • mfrom: (1430.2.4 moovida1_maybe)
  • Revision ID: philippe@fluendo.com-20090623145745-sf55n46edd15q6v3
use defer.maybeDeferred when iterating on decorators

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
def failing_decorator_two(controller):
64
64
    return defer.fail(Exception('woot'))
65
65
 
 
66
def returns_none_decorator(controller):
 
67
    controller.decorated += 1
 
68
    return None
66
69
 
67
70
class PluginRegistryStub(object):
68
71
    def get_enabled_plugins(self):
265
268
 
266
269
        return dfr
267
270
 
 
271
    def test_broken_decorator(self):
 
272
        """
 
273
        Test a decorator not returning a deferred doesn't break the
 
274
        controller decoration.
 
275
        """
 
276
        self.frontend.add_controller('/elisa/album/.*', GenericAlbumController)
 
277
        self.frontend.add_decorator('/elisa/album/.*', returns_none_decorator)
 
278
 
 
279
        def create_controller_callback(controller):
 
280
            self.failUnlessEqual(controller.decorated, 1)
 
281
 
 
282
        dfr = self.frontend.create_controller('/elisa/album/', Config(),
 
283
                wait_for_decorators=True)
 
284
        dfr.addCallback(create_controller_callback)
 
285
 
 
286
        return dfr
 
287
 
268
288
    def test_decorate_clean(self):
269
289
        """
270
290
        Test the clean signal as used by a decorator.