1
from twisted.web2.test.test_server import BaseCase
5
from twisted.web import resource
7
class OldWebResource(resource.Resource):
8
def __init__(self, message, *args, **kwargs):
10
resource.Resource.__init__(self, *args, **kwargs)
14
def render(self, req):
20
class OldWebCompat(BaseCase):
24
skip = "can't run w/o twisted.web"
26
def testOldWebResource(self):
27
ow = OldWebResource('I am an OldWebResource')
29
self.assertResponse((ow, "http://localhost/"),
30
(200, {}, 'I am an OldWebResource'))
32
def testOldWebResourceNotLeaf(self):
33
ow = OldWebResource('I am not a leaf')
36
self.assertResponse((ow, "http://localhost/"),
37
(200, {}, 'I am not a leaf'))
39
def testOldWebResourceWithChildren(self):
41
ow = OldWebResource('I am an OldWebResource with a child')
46
OldWebResource('I am a child of an OldWebResource'))
48
self.assertResponse((ow, "http://localhost/"),
50
'I am an OldWebResource with a child'))
52
self.assertResponse((ow, "http://localhost/child"),
54
'I am a child of an OldWebResource'))
58
OldWebCompat.skip = "can't run w/o twisted.web"