Skip to content

Instantly share code, notes, and snippets.

@clayg
Created March 1, 2014 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/9284362 to your computer and use it in GitHub Desktop.
Save clayg/9284362 to your computer and use it in GitHub Desktop.
diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py
index 074bba6..e85ec45 100755
--- a/test/unit/obj/test_server.py
+++ b/test/unit/obj/test_server.py
@@ -661,6 +661,23 @@ class TestObjectController(unittest.TestCase):
resp = req.get_response(self.object_controller)
self.assertEquals(resp.status_int, 408)
+ def test_slow_client_timeout(self):
+ def exploding_iter():
+ for i in range(3):
+ yield 'a' * 64
+ raise object_server.ChunkReadTimeout()
+ file_like_exploder = mock.MagicMock()
+ file_like_exploder.read.side_effect = exploding_iter()
+ timestamp = normalize_timestamp(time())
+ req = Request.blank(
+ '/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
+ headers={'X-Timestamp': timestamp,
+ 'Content-Type': 'text/plain',
+ 'Content-Length': '6'})
+ req.environ['wsgi.input'] = file_like_exploder
+ resp = req.get_response(self.object_controller)
+ self.assertEquals(resp.status_int, 408)
+
def test_PUT_container_connection(self):
def mock_http_connect(response, with_exc=False):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment