def test_connects_right(self): """Uses the CONNECT method on the tunnel.""" self._assert_connection()
def test_starts_tls_connection(self): """TLS is started after connecting; control passed to the client.""" self._assert_connection(is_ssl=True)
Although if you think it does not bring anything to the code you can leave the tests as they are.
Since all the above comments are just about tests and writing less code I'll approve and will trust you to apply or not the comments if you feel they are needed :)
In TunnelClientPro tocolTestCase I see that we do a number of times the following:
75 + other_proto = protocol.Protocol() ClientFactory( ) buildProtocol = lambda _addr: other_proto client_ factory = tunnel_ client. TunnelClientFac tory(host, port, client_ factory. buildProtocol( fake_addr) client_ proto.transport = FakeTransport() client_ proto.connectio nMade()
76 + other_factory = protocol.
77 + other_factory.
78 + tunnel_
79 + other_factory)
80 + tunnel_client_proto = tunnel_
81 + tunnel_
82 + tunnel_
Would't it be a good idea to move that to the setUp?
In TunnelClientTes tCase you refactor the tests as follows:
def _assert_
if is_ssl:
def test_connects_ right(self) :
"""Uses the CONNECT method on the tunnel."""
self. _assert_ connection( )
def test_starts_ tls_connection( self):
"""TLS is started after connecting; control passed to the client."""
self. _assert_ connection( is_ssl= True)
Although if you think it does not bring anything to the code you can leave the tests as they are.
Since all the above comments are just about tests and writing less code I'll approve and will trust you to apply or not the comments if you feel they are needed :)