本文整理汇总了Python中twisted.trial.unittest.assertEquals函数的典型用法代码示例。如果您正苦于以下问题:Python assertEquals函数的具体用法?Python assertEquals怎么用?Python assertEquals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assertEquals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: closed
def closed(self):
log.msg("calling shell closed")
if self.status != 0:
log.msg("shell exit status was not 0: %i" % self.status)
unittest.assertEquals(self.testBuf, "testing the shell!\x00\r\n")
unittest.assert_(self.eofCalled)
log.msg("finished shell")
self.conn.addResult()
示例2: receiveError
def receiveError(self, reasonCode, desc):
self.expectedLoseConnection = 1
# Some versions of OpenSSH (for example, OpenSSH_5.3p1) will
# send a DISCONNECT_BY_APPLICATION error before closing the
# connection. Other, older versions (for example,
# OpenSSH_5.1p1), won't. So accept this particular error here,
# but no others.
unittest.assertEquals(
reasonCode, transport.DISCONNECT_BY_APPLICATION,
'got disconnect for %s: reason %s, desc: %s' % (
self, reasonCode, desc))
self.loseConnection()
示例3: _cbRealRequestWorked
def _cbRealRequestWorked(self, ignored):
d1 = self.conn.sendGlobalRequest('foo', 'bar', 1)
d1.addErrback(self._ebFirstGlobal)
d2 = self.conn.sendGlobalRequest('foo-2', 'bar2', 1)
d2.addCallback(lambda x: unittest.assertEquals(x, 'data'))
d2.addErrback(self._ebSecondGlobal)
d3 = self.conn.sendGlobalRequest('bar', 'foo', 1)
d3.addCallback(self._cbThirdGlobal)
d3.addErrback(lambda x,s=self: log.msg('subsystem finished') or s.conn.addResult() or s.loseConnection())
示例4: _cbRealRequestWorked
def _cbRealRequestWorked(self, ignored):
d1 = self.conn.sendGlobalRequest("foo", "bar", 1)
d1.addErrback(self._ebFirstGlobal)
d2 = self.conn.sendGlobalRequest("foo-2", "bar2", 1)
d2.addCallback(lambda x: unittest.assertEquals(x, "data"))
d2.addErrback(self._ebSecondGlobal)
d3 = self.conn.sendGlobalRequest("bar", "foo", 1)
d3.addCallback(self._cbThirdGlobal)
d3.addErrback(lambda x, s=self: log.msg("subsystem finished") or s.conn.addResult() or s.loseConnection())
示例5: global_foo_2
def global_foo_2(self, data):
unittest.assertEquals(data, 'bar2')
return 1, 'data'
示例6: global_foo
def global_foo(self, data):
unittest.assertEquals(data, 'bar')
return 1
示例7: verifyHostKey
def verifyHostKey(self, key, fp):
unittest.assertEquals(key, keys.Key.fromString(publicRSA_openssh).blob())
unittest.assertEquals(fp,'3d:13:5f:cb:c9:79:8a:93:06:27:65:bc:3d:0b:8f:af')
return defer.succeed(1)
示例8: requestAvatar
def requestAvatar(self, avatarID, mind, *interfaces):
unittest.assertEquals(avatarID, 'testuser')
a = ConchTestAvatar()
return interfaces[0], a, a.logout
示例9: verifyHostKey
def verifyHostKey(self, key, fp):
unittest.assertEquals(key, keys.getPublicKeyString(data=publicRSA_openssh))
unittest.assertEquals(fp, "3d:13:5f:cb:c9:79:8a:93:06:27:65:bc:3d:0b:8f:af")
return defer.succeed(1)
示例10: openShell
def openShell(self, proto):
log.msg('openning shell')
unittest.assertEquals(self.ptyReq, True)
self.proto = proto
EchoTransport(proto)
self.cmd = 'shell'
示例11: checkKey
def checkKey(self, credentials):
unittest.assertEquals(credentials.username, 'testuser', 'bad username')
unittest.assertEquals(credentials.blob, keys.getPublicKeyString(data=publicDSA_openssh))
return 1
示例12: processEnded
def processEnded(self, reason):
unittest.assertEquals(reason.value.exitCode, 0, 'exit code was not 0: %s' % reason.value.exitCode)
self.buf = self.buf.replace('\r\n', '\n')
unittest.assertEquals(self.buf, 'goodbye\n')
self.deferred.callback(None)
示例13: extReceived
def extReceived(self, dataType, data):
unittest.assertEquals(dataType, connection.EXTENDED_DATA_STDERR)
self.testExtBuf += data
示例14: checkKey
def checkKey(self, credentials):
unittest.assertEquals(credentials.username, 'testuser', 'bad username')
unittest.assertEquals(credentials.blob, keys.Key.fromString(publicDSA_openssh).blob())
return 1
示例15: requestAvatarId
def requestAvatarId(self, credentials):
unittest.assertEquals(credentials.username, 'testuser', 'bad username')
unittest.assertEquals(credentials.password, 'testpass', 'bad password')
return defer.succeed(credentials.username)