include tornado/test/README
include tornado/test/test.crt
include tornado/test/test.key
+include tornado/test/static/robots.txt
global-exclude _auto2to3*
\ No newline at end of file
packages = ["tornado", "tornado.test", "tornado.platform"],
package_data = {
"tornado": ["ca-certificates.crt"],
- "tornado.test": ["README", "test.crt", "test.key"],
+ "tornado.test": ["README", "test.crt", "test.key", "static/robots.txt"],
},
ext_modules = extensions,
author="Facebook",
import binascii
import logging
+import os
import re
import socket
import sys
response = self.fetch("/failed_write_error")
self.assertEqual(response.code, 500)
self.assertEqual(b(""), response.body)
+
+class StaticFileTest(AsyncHTTPTestCase, LogTrapTestCase):
+ def get_app(self):
+ class StaticUrlHandler(RequestHandler):
+ def get(self, path):
+ self.write(self.static_url(path))
+
+ return Application([('/static_url/(.*)', StaticUrlHandler)],
+ static_path=os.path.join(os.path.dirname(__file__), 'static'))
+
+ def test_static_files(self):
+ response = self.fetch('/robots.txt')
+ assert b("Disallow: /") in response.body
+
+ response = self.fetch('/static/robots.txt')
+ assert b("Disallow: /") in response.body
+
+ def test_static_url(self):
+ response = self.fetch("/static_url/robots.txt")
+ self.assertEqual(response.body, b("/static/robots.txt?v=f71d2"))