Merge lp:~alecu/ubuntuone-client/proxy-tunnel-client into lp:ubuntuone-client
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Alejandro J. Cura on 2012-03-09 | ||||
| Approved revision: | 1212 | ||||
| Merged at revision: | 1203 | ||||
| Proposed branch: | lp:~alecu/ubuntuone-client/proxy-tunnel-client | ||||
| Merge into: | lp:ubuntuone-client | ||||
| Prerequisite: | lp:~alecu/ubuntuone-client/proxy-tunnel-server | ||||
| Diff against target: |
264 lines (+247/-0) 3 files modified
tests/proxy/test_tunnel_client.py (+144/-0) tests/proxy/test_tunnel_server.py (+2/-0) ubuntuone/proxy/tunnel_client.py (+101/-0) |
||||
| To merge this branch: | bzr merge lp:~alecu/ubuntuone-client/proxy-tunnel-client | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Natalia Bidart | 2012-02-28 | Approve on 2012-03-09 | |
| Manuel de la Peña (community) | 2012-02-28 | Approve on 2012-03-09 | |
|
Review via email:
|
|||
Commit Message
- A client for the proxy tunnel, to be used by syncdaemon (LP: #929207).
Description of the Change
- A client for the proxy tunnel, to be used by syncdaemon (LP: #929207)
- 1208. By Alejandro J. Cura on 2012-02-29
-
merged with source branch
- 1209. By Alejandro J. Cura on 2012-03-02
-
Merged proxy-tunnel-server into proxy-tunnel-
client. - 1210. By Alejandro J. Cura on 2012-03-06
-
Merged proxy-tunnel-server into proxy-tunnel-
client. - 1211. By Alejandro J. Cura on 2012-03-07
-
Merged proxy-tunnel-server into proxy-tunnel-
client.
| Natalia Bidart (nataliabidart) wrote : | # |
* Can you please use the same encoding definition header from old files in the new file? Also, can you add the encoding header to tests/proxy/
The rest looks good!
- 1212. By Alejandro J. Cura on 2012-03-09
-
fixes requested on the reviews
| Alejandro J. Cura (alecu) wrote : | # |
> In TunnelClientPro
> following:
>
> 75 + other_proto = protocol.Protocol()
> 76 + other_factory = protocol.
> 77 + other_factory.
> 78 + tunnel_
> 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?
Good idea, I've moved it to the setUp.
> In TunnelClientTes
>
> @defer.
> def _assert_
> """Asseert the connection."""
> tunnel_client = TunnelClient(
> self.tunnel_
> factory = client.
> scheme, host, port, path = client.
> if is_ssl:
> context_factory = ssl.ClientConte
> tunnel_
> context_factory)
> else:
> tunnel_
> result = yield factory.deferred
> self.assertEqua
>
> def test_connects_
> """Uses the CONNECT method on the tunnel."""
> self._assert_
>
> def test_starts_
> """TLS is started after connecting; control passed to the
> client."""
> self._assert_
>
> Although if you think it does not bring anything to the code you can leave the
> tests as they are.
This case is a bit more delicate, because not only the connectXXX method is different and needs to have an if like you've put, but also the url is different too. I think it's not worth it to refactor the test on this particular test.
thanks the review!
| Alejandro J. Cura (alecu) wrote : | # |
> * Can you please use the same encoding definition header from old files in the
> new file? Also, can you add the encoding header to
> tests/proxy/
Fixed, thanks for pointing it out.


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 :)