OLD | NEW |
| (Empty) |
1 # Copyright (c) 2008 Twisted Matrix Laboratories. | |
2 # See LICENSE for details. | |
3 | |
4 """ | |
5 Tests for L{twisted.web.tap}. | |
6 """ | |
7 | |
8 from twisted.trial.unittest import TestCase | |
9 | |
10 from twisted.web.server import Site | |
11 from twisted.web.static import Data | |
12 from twisted.web.distrib import ResourcePublisher | |
13 from twisted.web.tap import makePersonalServerFactory | |
14 | |
15 from twisted.spread.pb import PBServerFactory | |
16 | |
17 | |
18 class ServiceTests(TestCase): | |
19 """ | |
20 Tests for the service creation APIs in L{twisted.web.tap}. | |
21 """ | |
22 def test_makePersonalServerFactory(self): | |
23 """ | |
24 L{makePersonalServerFactory} returns a PB server factory which has | |
25 as its root object a L{ResourcePublisher}. | |
26 """ | |
27 # The fact that this pile of objects can actually be used somehow is | |
28 # verified by twisted.web.test.test_distrib. | |
29 site = Site(Data("foo bar", "text/plain")) | |
30 serverFactory = makePersonalServerFactory(site) | |
31 self.assertIsInstance(serverFactory, PBServerFactory) | |
32 self.assertIsInstance(serverFactory.root, ResourcePublisher) | |
33 self.assertIdentical(serverFactory.root.site, site) | |
OLD | NEW |