def assertCommandResponse(self, command, expectedResponseLines,
chainDeferred=None):
"""Asserts that a sending an FTP command receives the expected
response.
Returns a Deferred. Optionally accepts a deferred to chain its actions
to.
"""
if chainDeferred is None:
chainDeferred = defer.succeed(None)
def queueCommand(ignored):
d = self.client.queueStringCommand(command)
def gotResponse(responseLines):
self.assertEquals(expectedResponseLines, responseLines)
return d.addCallback(gotResponse)
return chainDeferred.addCallback(queueCommand)
评论列表
文章目录