1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
From cb9378c0af823ca833b8088ca76998267817ab91 Mon Sep 17 00:00:00 2001
From: Julian Taylor <jtaylor.debian@googlemail.com>
Date: Fri, 23 Dec 2016 15:56:28 +0100
Subject: disable i2p tests
txi2p is not packaged in debian yet
---
src/foolscap/test/test_connection.py | 105 +----------------------------------
1 file changed, 1 insertion(+), 104 deletions(-)
diff --git a/src/foolscap/test/test_connection.py b/src/foolscap/test/test_connection.py
index f80310e..a80c9c6 100644
--- a/src/foolscap/test/test_connection.py
+++ b/src/foolscap/test/test_connection.py
@@ -12,7 +12,7 @@ from txsocksx.client import SOCKS5ClientEndpoint
from foolscap.api import Tub
from foolscap.info import ConnectionInfo
from foolscap.connection import get_endpoint
-from foolscap.connections import tcp, socks, tor, i2p
+from foolscap.connections import tcp, socks, tor
from foolscap.tokens import NoLocationHintsError
from foolscap.ipb import InvalidHintError
from foolscap.test.common import (certData_low, certData_high, Target,
@@ -562,106 +562,3 @@ class Tor(unittest.TestCase):
self.assertEqual(h._socks_desc, "tcp:127.0.0.1:1234")
-
-class I2P(unittest.TestCase):
- @inlineCallbacks
- def test_default(self):
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- n.return_value = expected_ep = object()
- h = i2p.default(reactor, misc_kwarg="foo")
- res = yield h.hint_to_endpoint("i2p:fppym.b32.i2p", reactor,
- discard_status)
- self.assertEqual(len(n.mock_calls), 1)
- args = n.mock_calls[0][1]
- got_sep, got_host, got_portnum = args
- self.assertIsInstance(got_sep, endpoints.TCP4ClientEndpoint)
- self.failUnlessEqual(got_sep._host, "127.0.0.1") # fragile
- self.failUnlessEqual(got_sep._port, 7656)
- self.failUnlessEqual(got_host, "fppym.b32.i2p")
- self.failUnlessEqual(got_portnum, None)
- kwargs = n.mock_calls[0][2]
- self.failUnlessEqual(kwargs, {"misc_kwarg": "foo"})
-
- ep, host = res
- self.assertIdentical(ep, expected_ep)
- self.assertEqual(host, "fppym.b32.i2p")
- self.assertEqual(h.describe(), "i2p")
-
- @inlineCallbacks
- def test_default_with_portnum(self):
- # I2P addresses generally don't use port numbers, but the parser is
- # supposed to handle them
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- n.return_value = expected_ep = object()
- h = i2p.default(reactor)
- res = yield h.hint_to_endpoint("i2p:fppym.b32.i2p:1234", reactor,
- discard_status)
- self.assertEqual(len(n.mock_calls), 1)
- args = n.mock_calls[0][1]
- got_sep, got_host, got_portnum = args
- self.assertIsInstance(got_sep, endpoints.TCP4ClientEndpoint)
- self.failUnlessEqual(got_sep._host, "127.0.0.1") # fragile
- self.failUnlessEqual(got_sep._port, 7656)
- self.failUnlessEqual(got_host, "fppym.b32.i2p")
- self.failUnlessEqual(got_portnum, 1234)
- ep, host = res
- self.assertIdentical(ep, expected_ep)
- self.assertEqual(host, "fppym.b32.i2p")
-
- @inlineCallbacks
- def test_default_with_portnum_kwarg(self):
- # setting extra kwargs on the handler should provide a default for
- # the portnum. sequential calls with/without portnums in the hints
- # should get the right values.
- h = i2p.default(reactor, port=1234)
-
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- yield h.hint_to_endpoint("i2p:fppym.b32.i2p", reactor,
- discard_status)
- got_portnum = n.mock_calls[0][1][2]
- self.failUnlessEqual(got_portnum, 1234)
-
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- yield h.hint_to_endpoint("i2p:fppym.b32.i2p:3456", reactor,
- discard_status)
- got_portnum = n.mock_calls[0][1][2]
- self.failUnlessEqual(got_portnum, 3456)
-
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- yield h.hint_to_endpoint("i2p:fppym.b32.i2p", reactor,
- discard_status)
- got_portnum = n.mock_calls[0][1][2]
- self.failUnlessEqual(got_portnum, 1234)
-
- def test_default_badhint(self):
- h = i2p.default(reactor)
- d = defer.maybeDeferred(h.hint_to_endpoint, "i2p:not@a@hint", reactor,
- discard_status)
- f = self.failureResultOf(d, InvalidHintError)
- self.assertEqual(str(f.value), "unrecognized I2P hint")
-
- @inlineCallbacks
- def test_sam_endpoint(self):
- with mock.patch("foolscap.connections.i2p.SAMI2PStreamClientEndpoint") as sep:
- sep.new = n = mock.Mock()
- n.return_value = expected_ep = object()
- my_ep = FakeHostnameEndpoint(reactor, "localhost", 1234)
- h = i2p.sam_endpoint(my_ep, misc_kwarg="foo")
- res = yield h.hint_to_endpoint("i2p:fppym.b32.i2p", reactor,
- discard_status)
- self.assertEqual(len(n.mock_calls), 1)
- args = n.mock_calls[0][1]
- got_sep, got_host, got_portnum = args
- self.assertIdentical(got_sep, my_ep)
- self.failUnlessEqual(got_host, "fppym.b32.i2p")
- self.failUnlessEqual(got_portnum, None)
- kwargs = n.mock_calls[0][2]
- self.failUnlessEqual(kwargs, {"misc_kwarg": "foo"})
- ep, host = res
- self.assertIdentical(ep, expected_ep)
- self.assertEqual(host, "fppym.b32.i2p")
|