1 | from twisted.trial import unittest |
---|
2 | from twisted.spread import pb, jelly |
---|
3 | |
---|
4 | class Receiver(pb.Root): |
---|
5 | pass |
---|
6 | |
---|
7 | class PBWithSecurityOptionsTest(unittest.TestCase): |
---|
8 | def testSecOptions(self): |
---|
9 | import copy |
---|
10 | gs=copy.copy(jelly.globalSecurity) |
---|
11 | gs.isModuleAllowed=jelly.DummySecurityOptions().isModuleAllowed |
---|
12 | gs.isClassAllowed=jelly.DummySecurityOptions().isClassAllowed |
---|
13 | gs.isTypeAllowed=jelly.DummySecurityOptions().isTypeAllowed |
---|
14 | |
---|
15 | factory = pb.PBClientFactory(gs) |
---|
16 | factory.clientConnectionMade(pb.Broker(0)) |
---|
17 | serverFactory=pb.PBServerFactory(Receiver(),security=gs) |
---|
18 | self.assertEquals(gs, factory.security) |
---|
19 | self.assertEquals(gs, factory._broker.security) |
---|
20 | proto = serverFactory.buildProtocol("127.0.0.1") |
---|
21 | self.assertEquals(gs, proto.security) |
---|
22 | |
---|