|
Revision 1710
(checked in by fumanchu, 1 year ago)
|
Moved refleak test into its own module and added it to main test suite.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
"""Tests for managing HTTP issues (malformed requests, etc). |
|---|
| 2 |
|
|---|
| 3 |
Some of these tests check timeouts, etcetera, and therefore take a long |
|---|
| 4 |
time to run. Therefore, this module should probably not be included in |
|---|
| 5 |
the 'comprehensive' test suite (test.py). |
|---|
| 6 |
""" |
|---|
| 7 |
|
|---|
| 8 |
from cherrypy.test import test |
|---|
| 9 |
test.prefer_parent_path() |
|---|
| 10 |
|
|---|
| 11 |
import httplib |
|---|
| 12 |
import cherrypy |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
def setup_server(): |
|---|
| 16 |
|
|---|
| 17 |
class Root: |
|---|
| 18 |
def index(self, *args, **kwargs): |
|---|
| 19 |
return "Hello world!" |
|---|
| 20 |
index.exposed = True |
|---|
| 21 |
|
|---|
| 22 |
cherrypy.tree.mount(Root()) |
|---|
| 23 |
cherrypy.config.update({'environment': 'test_suite'}) |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
from cherrypy.test import helper |
|---|
| 27 |
|
|---|
| 28 |
class HTTPTests(helper.CPWebCase): |
|---|
| 29 |
|
|---|
| 30 |
def test_sockets(self): |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
c = httplib.HTTPConnection("localhost:%s" % self.PORT) |
|---|
| 35 |
c.request("POST", "/") |
|---|
| 36 |
self.assertEqual(c.getresponse().status, 411) |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
if __name__ == '__main__': |
|---|
| 40 |
setup_server() |
|---|
| 41 |
helper.testmain() |
|---|