Here are the examples of the python api twisted.trial.unittest.fail taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
31 Examples
3
Example 1
def global_tcpip_forward(self, data):
host, port = forwarding.unpackGlobal_tcpip_forward(data)
try: listener = reactor.listenTCP(port,
forwarding.SSHListenForwardingFactory(self.conn,
(host, port),
forwarding.SSHListenServerForwardingChannel),
interface = host)
except:
log.err()
unittest.fail("something went wrong with remote->local forwarding")
return 0
else:
self.listeners[(host, port)] = listener
return 1
3
Example 2
def connectionLost(self, reason):
if self.done:
return
if not hasattr(self,'expectedLoseConnection'):
unittest.fail('unexpectedly lost connection %s\n%s' % (self, reason))
self.done = 1
3
Example 3
Project: mythbox Source File: test_ssh.py
def request_exit_status(self, status):
status, = struct.unpack('>L', status)
if status == 0:
unittest.fail('false exit status was 0')
log.msg('finished false')
self.conn.addResult()
return 1
3
Example 4
def closed(self):
if self.status != 0:
unittest.fail('echo exit status was not 0: %i' % self.status)
if self.testBuf != "hello\r\n":
unittest.fail('echo did not return hello: %s' % repr(self.testBuf))
unittest.assertEquals(self.localWindowLeft, 4)
unittest.assert_(self.eofCalled)
log.msg('finished echo')
self.conn.addResult()
return 1
3
Example 5
def closed(self):
if self.status != 0:
unittest.fail('err exit status was not 0: %i' % self.status)
if self.testBuf != "hello\r\n":
unittest.fail('err did not return hello: %s' % repr(self.testBuf))
unittest.assertEquals(self.localWindowLeft, 4)
unittest.assert_(self.eofCalled)
log.msg('finished err')
self.conn.addResult()
return 1
3
Example 6
def closed(self):
if self.status != 0:
unittest.fail('echo exit status was not 0: %i' % self.status)
unittest.assertEquals(self.testBuf, 'hello\r\n')
unittest.assertEquals(self.testExtBuf, 'hello\r\n')
unittest.assertEquals(self.localWindowLeft, 12)
unittest.assert_(self.eofCalled)
log.msg('finished max packet')
self.conn.addResult()
return 1
0
Example 7
Project: mythbox Source File: test_ssh.py
def receiveUnimplemented(self, seqID):
unittest.fail('got unimplemented: seqid %s' % seqID)
self.expectedLoseConnection = 1
self.loseConnection()
0
Example 8
def ssh_USERAUTH_SUCCESS(self, packet):
if not self.canSucceedPassword and self.canSucceedPublicKey:
unittest.fail('got USERAUTH_SUCESS before password and publickey')
userauth.SSHUserAuthClient.ssh_USERAUTH_SUCCESS(self, packet)
0
Example 9
def channelOpen(self, ignored):
unittest.fail("opened unknown channel")
0
Example 10
def openFailed(self, reason):
unittest.fail('fail exec open failed: %s' % reason)
0
Example 11
def _cbRequestWorked(self, ignored):
unittest.fail('fail exec succeeded')
0
Example 12
def openFailed(self, reason):
unittest.fail('false open failed: %s' % reason)
0
Example 13
def _ebRequestFailed(self, reason):
unittest.fail('false exec failed: %s' % reason)
0
Example 14
def dataReceived(self, data):
unittest.fail('got data when using false')
0
Example 15
def openFailed(self, reason):
unittest.fail('echo open failed: %s' % reason)
0
Example 16
def _ebRequestFailed(self, reason):
unittest.fail('echo exec failed: %s' % reason)
0
Example 17
def errReceived(self, dataType, data):
unittest.fail('echo channel got extended data')
0
Example 18
def openFailed(self, reason):
unittest.fail('err open failed: %s' % reason)
0
Example 19
def _ebRequestFailed(self, reason):
unittest.fail('err exec failed: %s' % reason)
0
Example 20
def dataReceived(self, data):
unittest.fail('err channel got regular data: %s' % repr(data))
0
Example 21
def openFailed(self, reason):
unittest.fail('max packet open failed: %s' % reason)
0
Example 22
def _ebRequestFailed(self, reason):
unittest.fail('max packet exec failed: %s' % reason)
0
Example 23
def openFailed(self, reason):
unittest.fail('shell open failed: %s' % reason)
0
Example 24
Project: mythbox Source File: test_ssh.py
def _ebPtyReq(self, reason):
unittest.fail('pty request failed: %s' % reason)
0
Example 25
Project: mythbox Source File: test_ssh.py
def _ebShellOpen(self, reason):
unittest.fail('shell request failed: %s' % reason)
0
Example 26
def openFailed(self, reason):
unittest.fail('subsystem open failed: %s' % reason)
0
Example 27
def _cbRequestWorked(self, ignored):
unittest.fail('opened non-crazy subsystem')
0
Example 28
Project: mythbox Source File: test_ssh.py
def _ebRealRequestFailed(self, reason):
unittest.fail('opening crazy subsystem failed: %s' % reason)
0
Example 29
Project: mythbox Source File: test_ssh.py
def _ebFirstGlobal(self, reason):
unittest.fail('first global request failed: %s' % reason)
0
Example 30
Project: mythbox Source File: test_ssh.py
def _ebSecondGlobal(self, reason):
unittest.fail('second global request failed: %s' % reason)
0
Example 31
Project: mythbox Source File: test_ssh.py
def _cbThirdGlobal(self, ignored):
unittest.fail('second global request succeeded')