Skip to content

Commit

Permalink
Test timeout in client
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeas Moravec committed Jan 24, 2013
1 parent af365dd commit e2a8a6b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_client.py
Expand Up @@ -7,6 +7,7 @@
from twisted.web.server import Site
from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.internet.error import TimeoutError

from fastjsonrpc.client import ReceiverProtocol
from fastjsonrpc.client import StringProducer
Expand Down Expand Up @@ -247,3 +248,15 @@ def finished(result):

e.addCallback(finished)
return d

def test_timeout(self):
""" Google doesn't offer any services on our crazy ports """
addr = 'http://google.com:%s' % self.portNumber
proxy = Proxy(addr, jsonrpc.VERSION_1, connectTimeout=0.1)
d = proxy.callRemote('sleep', 5)

def finished(result):
self.assertTrue(isinstance(result.value, TimeoutError))

d.addErrback(finished)
return d

0 comments on commit e2a8a6b

Please sign in to comment.