1178
1178
if self._testing_pycurl():
1179
1179
# Oh my ! pycurl does not check for the port as part of
1180
1180
# no_proxy :-( So we just test the host part
1181
self.no_proxy_host = 'localhost'
1181
self.no_proxy_host = self.server.host
1183
1183
self.no_proxy_host = self.proxy_address
1184
1184
# The secondary server is the proxy
2100
2100
code, f = t._post('abc def end-of-body\n')
2101
2101
self.assertEqual('lalala whatever as long as itsssss\n', f.read())
2102
2102
self.assertActivitiesMatch()
2105
class TestActivity(tests.TestCase, TestActivityMixin):
2108
tests.TestCase.setUp(self)
2109
self.server = self._activity_server(self._protocol_version)
2111
self.activities = {}
2112
def report_activity(t, bytes, direction):
2113
count = self.activities.get(direction, 0)
2115
self.activities[direction] = count
2117
# We override at class level because constructors may propagate the
2118
# bound method and render instance overriding ineffective (an
2119
# alternative would be to define a specific ui factory instead...)
2120
self.orig_report_activity = self._transport._report_activity
2121
self._transport._report_activity = report_activity
2124
self._transport._report_activity = self.orig_report_activity
2125
self.server.tearDown()
2126
tests.TestCase.tearDown(self)
2129
class TestNoReportActivity(tests.TestCase, TestActivityMixin):
2132
tests.TestCase.setUp(self)
2133
# Unlike TestActivity, we are really testing ReportingFileSocket and
2134
# ReportingSocket, so we don't need all the parametrization. Since
2135
# ReportingFileSocket and ReportingSocket are wrappers, it's easier to
2136
# test them through their use by the transport than directly (that's a
2137
# bit less clean but far more simpler and effective).
2138
self.server = ActivityHTTPServer('HTTP/1.1')
2139
self._transport=_urllib.HttpTransport_urllib
2143
# We override at class level because constructors may propagate the
2144
# bound method and render instance overriding ineffective (an
2145
# alternative would be to define a specific ui factory instead...)
2146
self.orig_report_activity = self._transport._report_activity
2147
self._transport._report_activity = None
2150
self._transport._report_activity = self.orig_report_activity
2151
self.server.tearDown()
2152
tests.TestCase.tearDown(self)
2154
def assertActivitiesMatch(self):
2155
# Nothing to check here