Python twisted.test.proto_helpers.FakeDatagramTransport() Examples
The following are 8
code examples of twisted.test.proto_helpers.FakeDatagramTransport().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
twisted.test.proto_helpers
, or try the search function
.
Example #1
Source File: test_all.py From loopix with BSD 2-Clause "Simplified" License | 6 votes |
def loopix_mixes(): sec_params = SphinxParams(header_len=1024) dbManager.create_mixnodes_table('Mixnodes') mixes = [] pubs_mixes = [] for i in range(3): mix = LoopixMixNode(sec_params, 'Mix%d'%(i+1), 9999-i, '1.2.3.%d'%i, i) mix.transport = proto_helpers.FakeDatagramTransport() mix.config_params = mix.config_params._replace(DATABASE_NAME = 'test.db') mixes.append(mix) dbManager.insert_row_into_table('Mixnodes', [None, mix.name, mix.port, mix.host, sqlite3.Binary(petlib.pack.encode(mix.pubk)), mix.group]) pubs_mixes = [Mix(m.name, m.port, m.host, m.pubk, m.group) for m in mixes] return mixes, pubs_mixes
Example #2
Source File: test_all.py From loopix with BSD 2-Clause "Simplified" License | 6 votes |
def loopix_providers(): sec_params = SphinxParams(header_len=1024) dbManager.create_providers_table('Providers') providers = [] pubs_providers = [] for i in range(3): p = LoopixProvider(sec_params, 'Provider%d'%(i+1), 9995-i, '1.2.%d.4'%i) p.transport = proto_helpers.FakeDatagramTransport() p.config_params = p.config_params._replace(DATABASE_NAME = 'test.db') providers.append(p) dbManager.insert_row_into_table('Providers', [None, p.name, p.port, p.host, sqlite3.Binary(petlib.pack.encode(p.pubk))]) pubs_providers = [Provider(p.name, p.port, p.host, p.pubk) for p in providers] return providers, pubs_providers
Example #3
Source File: test_all.py From loopix with BSD 2-Clause "Simplified" License | 6 votes |
def loopix_clients(pubs_providers, pubs_mixes): sec_params = SphinxParams(header_len=1024) dbManager.create_users_table('Users') clients = [] pubs_clients = [] for i in range(3): provider = pubs_providers[i] c = LoopixClient(sec_params, 'Client%d'%(i+1), 9993 - i, '1.%d.3.4'%i, provider.name) c.register_mixes(pubs_mixes) c.transport = proto_helpers.FakeDatagramTransport() c.config_params = c.config_params._replace(DATABASE_NAME = 'test.db') c.provider = dbManager.select_provider_by_name(provider.name) clients.append(c) dbManager.insert_row_into_table('Users', [None, c.name, c.port, c.host, sqlite3.Binary(petlib.pack.encode(c.pubk)), c.provider.name]) pubs_clients = [User(c.name, c.port, c.host, c.pubk, c.provider) for c in clients] return clients, pubs_clients
Example #4
Source File: test_sip.py From python-for-android with Apache License 2.0 | 6 votes |
def setUp(self): self.proxy = sip.RegisterProxy(host="intarweb.us") self.proxy.authorizers = self.proxy.authorizers.copy() self.proxy.authorizers['digest'] = FakeDigestAuthorizer() self.registry = FakeRegistry("intarweb.us") self.proxy.registry = self.proxy.locator = self.registry self.transport = proto_helpers.FakeDatagramTransport() self.proxy.transport = self.transport r = TestRealm() p = cred.portal.Portal(r) c = cred.checkers.InMemoryUsernamePasswordDatabaseDontUse() c.addUser('exarkun@intarweb.us', 'password') p.registerChecker(c) self.proxy.portal = p
Example #5
Source File: test_dns.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def setUp(self): """ Create a L{dns.DNSDatagramProtocol} with a deterministic clock. """ self.clock = task.Clock() self.controller = TestController() self.proto = dns.DNSDatagramProtocol(self.controller) transport = proto_helpers.FakeDatagramTransport() self.proto.makeConnection(transport) self.proto.callLater = self.clock.callLater
Example #6
Source File: test_dns.py From learn_python3_spider with MIT License | 5 votes |
def setUp(self): """ Create a L{dns.DNSDatagramProtocol} with a deterministic clock. """ self.clock = task.Clock() self.controller = TestController() self.proto = dns.DNSDatagramProtocol(self.controller) transport = proto_helpers.FakeDatagramTransport() self.proto.makeConnection(transport) self.proto.callLater = self.clock.callLater
Example #7
Source File: test_dns.py From python-for-android with Apache License 2.0 | 5 votes |
def setUp(self): """ Create a L{dns.DNSDatagramProtocol} with a deterministic clock. """ self.clock = task.Clock() self.controller = TestController() self.proto = dns.DNSDatagramProtocol(self.controller) transport = proto_helpers.FakeDatagramTransport() self.proto.makeConnection(transport) self.proto.callLater = self.clock.callLater
Example #8
Source File: test_sip.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.proxy = sip.RegisterProxy(host="intarweb.us") self.proxy.authorizers = self.proxy.authorizers.copy() self.proxy.authorizers['digest'] = FakeDigestAuthorizer() self.registry = FakeRegistry("intarweb.us") self.proxy.registry = self.proxy.locator = self.registry self.transport = proto_helpers.FakeDatagramTransport() self.proxy.transport = self.transport r = TestRealm() p = cred.portal.Portal(r) c = cred.checkers.InMemoryUsernamePasswordDatabaseDontUse() c.addUser('exarkun@intarweb.us', 'password') p.registerChecker(c) self.proxy.portal = p