From 044b786778185a05b3759f2a61b4ec86c8ca81fd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 2 Jun 2015 16:39:27 +0530 Subject: [PATCH] Test for static generation --- src/calibre/srv/tests/http.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/calibre/srv/tests/http.py b/src/calibre/srv/tests/http.py index 88995a76d2..125784dfeb 100644 --- a/src/calibre/srv/tests/http.py +++ b/src/calibre/srv/tests/http.py @@ -349,3 +349,19 @@ class TestHTTP(BaseTest): self.assertLess(time_taken, 1, 'Large file transfer took too long') # }}} + + def test_static_generation(self): # {{{ + 'Test static generation' + nums = list(map(str, xrange(10))) + def handler(conn): + return conn.generate_static_output('test', nums.pop) + with TestServer(handler) as server: + conn = server.connect() + conn.request('GET', '/an_etagged_path') + r = conn.getresponse() + data = r.read() + for i in xrange(5): + conn.request('GET', '/an_etagged_path') + r = conn.getresponse() + self.assertEqual(data, r.read()) + # }}}