183
186
"""Assert that calling functions fails with `sftp_code`."""
184
187
deferred = defer.maybeDeferred(function, *args, **kwargs)
185
188
deferred = assert_fails_with(deferred, filetransfer.SFTPError)
186
190
def check_sftp_code(exception):
187
191
self.assertEqual(sftp_code, exception.code)
189
194
return deferred.addCallback(check_sftp_code)
191
196
def openFile(self, path, flags, attrs):