'Fail if C{deferred} does not errback with one of C{expectedFailures}.
Returns the original Deferred with callbacks added. You will need
to return this Deferred from your test case.'

def assertFailure(self, deferred, *expectedFailures):

    def _cb(ignore):
        raise self.failureException(('did    not    catch    an    error,    instead    got    %r' % (ignore,)))
    def _eb(failure):
        if failure.check(*expectedFailures):
            return failure.value
        else:
            output = ('\nExpected:    %r\nGot:\n%s' % (expectedFailures, str(failure)))
            raise self.failureException(output)
    return deferred.addCallbacks(_cb, _eb)
