コード例 #1
0
 def checkTCPEndpoint(self, hint, expected_host, expected_port):
     ep, host = get_endpoint(hint, {"tcp": DefaultTCP()})
     self.failUnless(isinstance(ep, endpoints.TCP4ClientEndpoint), ep)
     # note: this is fragile, and will break when Twisted changes the
     # internals of TCP4ClientEndpoint. Hopefully we'll switch to
     # HostnameEndpoint before then. Although that will break too.
     self.failUnlessEqual(ep._host, expected_host)
     self.failUnlessEqual(ep._port, expected_port)
コード例 #2
0
ファイル: test_connection.py プロジェクト: exarkun/foolscap
 def checkTCPEndpoint(self, hint, expected_host, expected_port):
     d = get_endpoint(hint, {"tcp": tcp.default()})
     (ep, host) = self.successResultOf(d)
     self.failUnless(isinstance(ep, endpoints.HostnameEndpoint), ep)
     # note: this is fragile, and will break when Twisted changes the
     # internals of HostnameEndpoint.
     self.failUnlessEqual(ep._host, expected_host)
     self.failUnlessEqual(ep._port, expected_port)
コード例 #3
0
 def checkTCPEndpoint(self, hint, expected_host, expected_port):
     with mock.patch("foolscap.connections.tcp.HostnameEndpoint",
                     side_effect=FakeHostnameEndpoint):
         d = get_endpoint(hint, {"tcp": tcp.default()}, ConnectionInfo())
     (ep, host) = self.successResultOf(d)
     self.assertTrue(isinstance(ep, FakeHostnameEndpoint), ep)
     self.assertIs(ep.reactor, reactor)
     self.assertEqual(ep.host, expected_host)
     self.assertEqual(ep.port, expected_port)
コード例 #4
0
 def checkUnknownEndpoint(self, hint):
     d = get_endpoint(hint, {"tcp": tcp.default()}, ConnectionInfo())
     self.failureResultOf(d, ipb.InvalidHintError)
コード例 #5
0
ファイル: test_connection.py プロジェクト: exarkun/foolscap
 def checkUnknownEndpoint(self, hint):
     d = get_endpoint(hint, {"tcp": tcp.default()})
     self.failureResultOf(d, ipb.InvalidHintError)
コード例 #6
0
 def checkBadTCPEndpoint(self, hint):
     d = get_endpoint(hint, {"tcp": tcp.default()}, ConnectionInfo())
     self.failureResultOf(d, ipb.InvalidHintError)