unit tests for timeout exception
This commit is contained in:
parent
bc9ec20033
commit
e999656935
@ -316,6 +316,8 @@ class TestContainerFailures(unittest.TestCase):
|
|||||||
self.assert_(object2 in [o['name'] for o in
|
self.assert_(object2 in [o['name'] for o in
|
||||||
client.get_container(self.url, self.token, container)[1]])
|
client.get_container(self.url, self.token, container)[1]])
|
||||||
|
|
||||||
|
def test_locked_container_dbs(self):
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -161,8 +161,10 @@ def fake_http_connect(*code_iter, **kwargs):
|
|||||||
self.body = body
|
self.body = body
|
||||||
|
|
||||||
def getresponse(self):
|
def getresponse(self):
|
||||||
if 'raise_exc' in kwargs:
|
if kwargs.get('raise_exc'):
|
||||||
raise Exception('test')
|
raise Exception('test')
|
||||||
|
if kwargs.get('raise_timeout_exc'):
|
||||||
|
raise TimeoutError()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def getexpect(self):
|
def getexpect(self):
|
||||||
@ -341,6 +343,14 @@ class TestController(unittest.TestCase):
|
|||||||
self.assertEqual(p, partition)
|
self.assertEqual(p, partition)
|
||||||
self.assertEqual(n, nodes)
|
self.assertEqual(n, nodes)
|
||||||
|
|
||||||
|
def test_make_requests(self):
|
||||||
|
with save_globals():
|
||||||
|
proxy_server.http_connect = fake_http_connect(200)
|
||||||
|
partition, nodes = self.controller.account_info(self.account)
|
||||||
|
proxy_server.http_connect = fake_http_connect(201,
|
||||||
|
raise_timeout_exc=True)
|
||||||
|
self.controller._make_request(nodes, partition, 'POST','/','','')
|
||||||
|
|
||||||
# tests if 200 is cached and used
|
# tests if 200 is cached and used
|
||||||
def test_account_info_200(self):
|
def test_account_info_200(self):
|
||||||
with save_globals():
|
with save_globals():
|
||||||
@ -1893,8 +1903,8 @@ class TestObjectController(unittest.TestCase):
|
|||||||
_test_sockets
|
_test_sockets
|
||||||
orig_update_request = prosrv.update_request
|
orig_update_request = prosrv.update_request
|
||||||
|
|
||||||
def broken_update_request(env, req):
|
def broken_update_request(*args, **kwargs):
|
||||||
raise Exception('fake')
|
raise Exception('fake: this should be printed')
|
||||||
|
|
||||||
prosrv.update_request = broken_update_request
|
prosrv.update_request = broken_update_request
|
||||||
sock = connect_tcp(('localhost', prolis.getsockname()[1]))
|
sock = connect_tcp(('localhost', prolis.getsockname()[1]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user