Merge lp:~dobey/ubuntu-sso-client/lint-roller into lp:ubuntu-sso-client
- lint-roller
- Merge into trunk
Proposed by
dobey
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | dobey | ||||
Approved revision: | 1011 | ||||
Merged at revision: | 1010 | ||||
Proposed branch: | lp:~dobey/ubuntu-sso-client/lint-roller | ||||
Merge into: | lp:ubuntu-sso-client | ||||
Diff against target: |
572 lines (+48/-81) 15 files modified
bin/ubuntu-sso-login (+1/-0) run-mac-tests (+2/-1) run-tests (+3/-2) run-tests.bat (+2/-1) ubuntu_sso/keyring/__init__.py (+5/-2) ubuntu_sso/networkstate/__init__.py (+0/-6) ubuntu_sso/networkstate/linux.py (+2/-6) ubuntu_sso/qt/main/__init__.py (+3/-5) ubuntu_sso/qt/proxy_dialog.py (+2/-8) ubuntu_sso/qt/ssl_dialog.py (+2/-4) ubuntu_sso/utils/__init__.py (+1/-3) ubuntu_sso/utils/tests/test_tcpactivation.py (+0/-20) ubuntu_sso/utils/tests/test_ui.py (+3/-3) ubuntu_sso/utils/webclient/__init__.py (+4/-10) ubuntu_sso/utils/webclient/tests/test_webclient.py (+18/-10) |
||||
To merge this branch: | bzr merge lp:~dobey/ubuntu-sso-client/lint-roller | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike McCracken (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+131016@code.launchpad.net |
Commit message
Switch to pyflakes.
Fix all the resulting issues from switching to pyflakes.
Description of the change
You'll likely need the version of pyflakes from ppa:ubuntuone/
To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/ubuntu-sso-login' |
2 | --- bin/ubuntu-sso-login 2012-06-27 20:00:27 +0000 |
3 | +++ bin/ubuntu-sso-login 2012-10-24 17:16:22 +0000 |
4 | @@ -33,6 +33,7 @@ |
5 | |
6 | # import decimal even if we don't need it, pylint: disable=W0611 |
7 | import decimal |
8 | +assert(decimal) |
9 | # This is a workaround for LP: #467397. Some module in our depency chain sets |
10 | # the locale and imports decimal, and that generates the following trace: |
11 | # Traceback (most recent call last): |
12 | |
13 | === modified file 'run-mac-tests' |
14 | --- run-mac-tests 2012-08-16 04:28:32 +0000 |
15 | +++ run-mac-tests 2012-10-24 17:16:22 +0000 |
16 | @@ -40,7 +40,7 @@ |
17 | style_check() { |
18 | USE_PYFLAKES=1 u1lint --ignore ubuntu_sso/qt/ui |
19 | if [ -x `which pep8` ]; then |
20 | - pep8 --exclude '.svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py' --repeat . bin/* |
21 | + pep8 --exclude '.bzr' --repeat . bin/* |
22 | else |
23 | echo "Please install the 'pep8' package." |
24 | fi |
25 | @@ -49,6 +49,7 @@ |
26 | echo "*** Running QT test suite for ""$MODULE"" ***" |
27 | python ./setup.py build |
28 | u1trial --reactor=qt4 --gui -i "test_linux.py, test_qt.py, test_windows.py, test_glib.py, test_txsecrets.py" "$MODULE" |
29 | +python ./setup.py clean |
30 | rm -rf _trial_temp |
31 | rm -rf build |
32 | |
33 | |
34 | === modified file 'run-tests' |
35 | --- run-tests 2012-06-27 19:03:44 +0000 |
36 | +++ run-tests 2012-10-24 17:16:22 +0000 |
37 | @@ -45,9 +45,9 @@ |
38 | fi |
39 | |
40 | style_check() { |
41 | - u1lint --ignore ubuntu_sso/qt/ui |
42 | + USE_PYFLAKES=1 u1lint --ignore ubuntu_sso/qt/ui |
43 | if [ -x `which pep8` ]; then |
44 | - pep8 --exclude '.svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py' --repeat . bin/* |
45 | + pep8 --exclude '.bzr' --repeat . bin/* |
46 | else |
47 | echo "Please install the 'pep8' package." |
48 | fi |
49 | @@ -62,6 +62,7 @@ |
50 | echo "*** Running QT test suite for ""$MODULE"" ***" |
51 | ./setup.py build |
52 | $XVFB_CMDLINE u1trial --reactor=qt4 --gui -i $LINUX_IGNORE_FILES "$MODULE" |
53 | +./setup.py clean |
54 | rm -rf _trial_temp |
55 | rm -rf build |
56 | |
57 | |
58 | === modified file 'run-tests.bat' |
59 | --- run-tests.bat 2012-10-04 19:25:14 +0000 |
60 | +++ run-tests.bat 2012-10-24 17:16:22 +0000 |
61 | @@ -85,10 +85,11 @@ |
62 | |
63 | ECHO Performing style checks... |
64 | SET IGNORE_LINT="ubuntu_sso\networkstate\linux.py,ubuntu_sso\main\linux.py,ubuntu_sso\main\tests\test_linux.py,ubuntu_sso\utils\txsecrets.py,ubuntu_sso\utils\tests\test_txsecrets.py,ubuntu_sso\tests\bin,bin\ubuntu-sso-login" |
65 | +SET USE_PYFLAKES=1 |
66 | "%LINTPATH%" -i "%IGNORE_LINT%" ubuntu_sso |
67 | :: test for style if we can, if pep8 is not present, move to the end |
68 | ECHO Running PEP-8 Check... |
69 | -"%PEP8PATH%" --repeat . |
70 | +"%PEP8PATH%" --exclude ".bzr" --repeat . bin\* |
71 | :CLEAN |
72 | |
73 | IF EXIST \.coverage RMDIR /s /q \.coverage |
74 | |
75 | === modified file 'ubuntu_sso/keyring/__init__.py' |
76 | --- ubuntu_sso/keyring/__init__.py 2012-07-31 20:51:00 +0000 |
77 | +++ ubuntu_sso/keyring/__init__.py 2012-10-24 17:16:22 +0000 |
78 | @@ -111,10 +111,13 @@ |
79 | returnValue(None) |
80 | |
81 | |
82 | +Keyring = None |
83 | if sys.platform in ('win32', 'darwin'): |
84 | - from ubuntu_sso.keyring.pykeyring import Keyring |
85 | + from ubuntu_sso.keyring import pykeyring |
86 | + Keyring = pykeyring.Keyring |
87 | else: |
88 | - from ubuntu_sso.keyring.linux import Keyring |
89 | + from ubuntu_sso.keyring import linux as linux_kr |
90 | + Keyring = linux_kr.Keyring |
91 | |
92 | |
93 | class UbuntuOneOAuthKeyring(Keyring): |
94 | |
95 | === modified file 'ubuntu_sso/networkstate/__init__.py' |
96 | --- ubuntu_sso/networkstate/__init__.py 2012-04-23 12:22:03 +0000 |
97 | +++ ubuntu_sso/networkstate/__init__.py 2012-10-24 17:16:22 +0000 |
98 | @@ -34,9 +34,6 @@ |
99 | # pylint: disable=C0103 |
100 | |
101 | NetworkManagerState = None |
102 | -ONLINE = None |
103 | -OFFLINE = None |
104 | -UNKNOWN = None |
105 | |
106 | |
107 | class NetworkFailException(Exception): |
108 | @@ -55,7 +52,4 @@ |
109 | networksource = linux |
110 | |
111 | NetworkManagerState = networksource.NetworkManagerState |
112 | -ONLINE = networksource.ONLINE |
113 | -OFFLINE = networksource.OFFLINE |
114 | -UNKNOWN = networksource.UNKNOWN |
115 | is_machine_connected = networksource.is_machine_connected |
116 | |
117 | === modified file 'ubuntu_sso/networkstate/linux.py' |
118 | --- ubuntu_sso/networkstate/linux.py 2012-10-05 14:39:37 +0000 |
119 | +++ ubuntu_sso/networkstate/linux.py 2012-10-24 17:16:22 +0000 |
120 | @@ -33,15 +33,13 @@ |
121 | from twisted.internet import defer |
122 | |
123 | from ubuntu_sso.networkstate import NetworkFailException |
124 | -# pylint: disable=W0611 |
125 | from ubuntu_sso.networkstate.networkstates import ( |
126 | - ONLINE, OFFLINE, UNKNOWN, |
127 | + ONLINE, OFFLINE, |
128 | |
129 | NM_STATE_CONNECTING_LIST, |
130 | NM_STATE_CONNECTED_LIST, |
131 | NM_STATE_DISCONNECTED_LIST, |
132 | ) |
133 | -# pylint: enable=W0611 |
134 | from ubuntu_sso.logger import setup_logging |
135 | logger = setup_logging("ubuntu_sso.networkstate") |
136 | |
137 | @@ -103,7 +101,7 @@ |
138 | nm_proxy.Get(NM_DBUS_INTERFACE, "State", |
139 | reply_handler=self.got_state, |
140 | error_handler=self.got_error) |
141 | - except Exception as e: # pylint: disable=W0703 |
142 | + except Exception as e: |
143 | self.got_error(e) |
144 | |
145 | |
146 | @@ -119,13 +117,11 @@ |
147 | result = (state == ONLINE) |
148 | d.callback(result) |
149 | |
150 | - # pylint: disable=W0702, W0703 |
151 | try: |
152 | network = NetworkManagerState(got_state) |
153 | network.find_online_state() |
154 | except Exception as e: |
155 | logger.exception('is_machine_connected failed with:') |
156 | d.errback(NetworkFailException(e)) |
157 | - # pylint: enable=W0702, W0703 |
158 | |
159 | return d |
160 | |
161 | === modified file 'ubuntu_sso/qt/main/__init__.py' |
162 | --- ubuntu_sso/qt/main/__init__.py 2012-07-03 16:36:41 +0000 |
163 | +++ ubuntu_sso/qt/main/__init__.py 2012-10-24 17:16:22 +0000 |
164 | @@ -34,21 +34,20 @@ |
165 | from PyQt4 import QtGui, QtCore |
166 | |
167 | # Module used to include the resources into this file |
168 | -# Unused import resources_rc, pylint: disable=W0611 |
169 | from ubuntu_sso.qt.ui import resources_rc |
170 | -# pylint: enable=W0611 |
171 | from ubuntu_sso.qt.ubuntu_sso_wizard import UbuntuSSOClientGUI |
172 | from ubuntu_sso.utils import compat, PLATFORM_QSS |
173 | |
174 | |
175 | -# Invalid name "source", pylint: disable=C0103 |
176 | +# Poke resources_rc to avoid pyflakes complaining about unused import |
177 | +assert(resources_rc) |
178 | + |
179 | if sys.platform in ('win32', 'darwin'): |
180 | from ubuntu_sso.qt.main import windows |
181 | source = windows |
182 | else: |
183 | from ubuntu_sso.qt.main import linux |
184 | source = linux |
185 | -# pylint: enable=C0103 |
186 | |
187 | |
188 | def main(**kwargs): |
189 | @@ -72,7 +71,6 @@ |
190 | if isinstance(value, compat.binary_type): |
191 | kwargs[key] = value.decode('utf-8') |
192 | |
193 | - # Unused variable 'ui', pylint: disable=W0612 |
194 | close_callback = lambda: source.main_quit(app) |
195 | ui = UbuntuSSOClientGUI(close_callback=close_callback, **kwargs) |
196 | style = QtGui.QStyle.alignedRect( |
197 | |
198 | === modified file 'ubuntu_sso/qt/proxy_dialog.py' |
199 | --- ubuntu_sso/qt/proxy_dialog.py 2012-07-03 16:14:49 +0000 |
200 | +++ ubuntu_sso/qt/proxy_dialog.py 2012-10-24 17:16:22 +0000 |
201 | @@ -115,15 +115,13 @@ |
202 | password = compat.text_type( |
203 | self.ui.password_entry.text()).encode('utf8') |
204 | creds = dict(username=username, password=password) |
205 | - # pylint: disable=W0703, W0612 |
206 | try: |
207 | logger.debug('Save credentials as for domain %s.', self.domain) |
208 | yield self.keyring.set_credentials(self.domain, creds) |
209 | except Exception as e: |
210 | - logger.exception('Could not set credentials:') |
211 | + logger.exception('Could not set credentials: %s', e) |
212 | self.done(EXCEPTION_RAISED) |
213 | logger.debug('Stored creds') |
214 | - # pylint: disable=W0703, W0612 |
215 | self.done(USER_SUCCESS) |
216 | |
217 | def _on_cancel_clicked(self, *args): |
218 | @@ -169,15 +167,13 @@ |
219 | |
220 | def main(): |
221 | """Main method used to show the creds dialog.""" |
222 | - # Keep ref to avoid core dump, pylint: disable=W0612 |
223 | - |
224 | if sys.platform == 'win32': |
225 | import qt4reactor |
226 | qt4reactor.install() |
227 | logger.debug('Qt reactor installed.') |
228 | |
229 | app = QApplication(sys.argv) |
230 | - # pylint: enable=W0612 |
231 | + app |
232 | args = parse_args() |
233 | win = ProxyCredsDialog(domain=args.domain, |
234 | retry=args.retry) |
235 | @@ -187,11 +183,9 @@ |
236 | win.finished.connect(exit_code) |
237 | |
238 | logger.debug('Starting reactor') |
239 | - # pylint: disable=E1101 |
240 | from twisted.internet import reactor |
241 | logger.debug('QApp is %s', reactor.qApp) |
242 | reactor.run() |
243 | - # pylint: enable=E1101 |
244 | else: |
245 | return_code = win.exec_() |
246 | sys.exit(return_code) |
247 | |
248 | === modified file 'ubuntu_sso/qt/ssl_dialog.py' |
249 | --- ubuntu_sso/qt/ssl_dialog.py 2012-04-09 17:38:24 +0000 |
250 | +++ ubuntu_sso/qt/ssl_dialog.py 2012-10-24 17:16:22 +0000 |
251 | @@ -41,9 +41,7 @@ |
252 | |
253 | from ubuntu_sso import USER_CANCELLATION, USER_SUCCESS |
254 | from ubuntu_sso.logger import setup_gui_logging |
255 | -# Unused import resources_rc, pylint: disable=W0611 |
256 | from ubuntu_sso.qt.ui import resources_rc |
257 | -# pylint: enable=W0611 |
258 | from ubuntu_sso.qt.expander import QExpander |
259 | from ubuntu_sso.qt.ui.ssl_dialog_ui import Ui_SSLDialog |
260 | from ubuntu_sso.utils.ui import ( |
261 | @@ -73,6 +71,7 @@ |
262 | '</ul>') |
263 | |
264 | logger = setup_gui_logging("ubuntu_sso.qt.proxy_dialog") |
265 | +assert(resources_rc) |
266 | |
267 | |
268 | class SSLDialog(QDialog): |
269 | @@ -165,9 +164,8 @@ |
270 | |
271 | def main(): |
272 | """Main method used to show the creds dialog.""" |
273 | - # pylint: disable=W0612 |
274 | app = QApplication(sys.argv) |
275 | - # pylint: enable=W0612 |
276 | + assert(app) |
277 | args = parse_args() |
278 | win = SSLDialog(args.appname, domain=args.domain, details=args.details) |
279 | return_code = win.exec_() |
280 | |
281 | === modified file 'ubuntu_sso/utils/__init__.py' |
282 | --- ubuntu_sso/utils/__init__.py 2012-10-15 22:08:54 +0000 |
283 | +++ ubuntu_sso/utils/__init__.py 2012-10-24 17:16:22 +0000 |
284 | @@ -83,9 +83,7 @@ |
285 | |
286 | # otherwise, try to load 'dir_constant' from installation path |
287 | try: |
288 | - # Unused variable 'ubuntu_sso' |
289 | - # pylint: disable=W0612, F0401, E0611 |
290 | - import ubuntu_sso.constants |
291 | + __import__('ubuntu_sso.constants', None, None, ['']) |
292 | module = sys.modules.get('ubuntu_sso.constants') |
293 | return getattr(module, dir_constant) |
294 | except (ImportError, AttributeError): |
295 | |
296 | === modified file 'ubuntu_sso/utils/tests/test_tcpactivation.py' |
297 | --- ubuntu_sso/utils/tests/test_tcpactivation.py 2012-06-27 21:58:15 +0000 |
298 | +++ ubuntu_sso/utils/tests/test_tcpactivation.py 2012-10-24 17:16:22 +0000 |
299 | @@ -31,19 +31,10 @@ |
300 | |
301 | from __future__ import print_function |
302 | |
303 | -# twisted uses a different coding convention |
304 | -# pylint: disable=C0103,W0232 |
305 | - |
306 | -# this test module access a few protected members (starting with _) |
307 | -# pylint: disable=W0212 |
308 | - |
309 | import twisted.internet |
310 | from twisted.internet import defer, protocol, task |
311 | from twisted.trial.unittest import TestCase |
312 | |
313 | -# pylint: disable=W0611 |
314 | -from ubuntuone.devtools.testcases import skipIfOS |
315 | -# pylint: enable=W0611 |
316 | from ubuntuone.devtools.testcases.txsocketserver import ( |
317 | ServerTestCase, |
318 | TidyTCPServer, |
319 | @@ -248,7 +239,6 @@ |
320 | class TestConnect(object): |
321 | """A fake connection object.""" |
322 | |
323 | - # pylint: disable=E0213 |
324 | @defer.inlineCallbacks |
325 | def connect(my_self, factory): |
326 | """A fake connection.""" |
327 | @@ -258,14 +248,12 @@ |
328 | self.patch(factory, 'is_listening', |
329 | connected_factory.is_listening) |
330 | defer.returnValue(connected_factory) |
331 | - # pylint: enable=E0213 |
332 | |
333 | self.patch(tcpactivation, 'clientFromString', |
334 | lambda *args: TestConnect()) |
335 | |
336 | yield server.listen_server(protocol.ServerFactory) |
337 | |
338 | - # pylint: disable=E1101 |
339 | ad = ActivationDetector(self.config) |
340 | result = yield ad.is_already_running() |
341 | self.assertTrue(result, "It should be already running.") |
342 | @@ -402,7 +390,6 @@ |
343 | description = yield ai.get_server_description() |
344 | self.assertEqual(description, self.server_description) |
345 | |
346 | - #pylint:disable=W0201 |
347 | @defer.inlineCallbacks |
348 | def test_get_description_fails_if_service_already_started(self): |
349 | """The get_description method fails if service already started.""" |
350 | @@ -412,7 +399,6 @@ |
351 | class TestConnect(object): |
352 | """A fake connection object.""" |
353 | |
354 | - # pylint: disable=E0213 |
355 | @defer.inlineCallbacks |
356 | def connect(my_self, factory): |
357 | """A fake connection.""" |
358 | @@ -422,7 +408,6 @@ |
359 | self.patch(factory, 'is_listening', |
360 | connected_factory.is_listening) |
361 | defer.returnValue(connected_factory) |
362 | - # pylint: enable=E0213 |
363 | |
364 | self.patch(tcpactivation, 'clientFromString', |
365 | lambda *args: TestConnect()) |
366 | @@ -432,7 +417,6 @@ |
367 | ai = ActivationInstance(self.config) |
368 | yield self.assertFailure(ai.get_server_description(), |
369 | AlreadyStartedError) |
370 | - #pylint:enable=W0201 |
371 | |
372 | |
373 | def server_test(config): |
374 | @@ -445,7 +429,6 @@ |
375 | |
376 | # start listening |
377 | f = FakeServerFactory() |
378 | - # pylint: disable=E1101 |
379 | reactor.listenTCP(description, f) |
380 | |
381 | # try to get the description again |
382 | @@ -454,7 +437,6 @@ |
383 | def already_started(failure): |
384 | """This instance was already started.""" |
385 | print("already started!") |
386 | - # pylint: disable=E1101 |
387 | reactor.callLater(3, reactor.stop) |
388 | |
389 | def get_description(): |
390 | @@ -466,7 +448,6 @@ |
391 | print("starting the server.") |
392 | ai = ActivationInstance(config) |
393 | get_description() |
394 | - # pylint: disable=E1101 |
395 | reactor.run() |
396 | |
397 | |
398 | @@ -483,7 +464,6 @@ |
399 | reactor.stop() |
400 | |
401 | d.addCallback(got_description) |
402 | - # pylint: disable=E1101 |
403 | reactor.run() |
404 | |
405 | |
406 | |
407 | === modified file 'ubuntu_sso/utils/tests/test_ui.py' |
408 | --- ubuntu_sso/utils/tests/test_ui.py 2012-09-13 13:52:40 +0000 |
409 | +++ ubuntu_sso/utils/tests/test_ui.py 2012-10-24 17:16:22 +0000 |
410 | @@ -43,9 +43,9 @@ |
411 | """Test whether importing ui module defines _ as a builtin.""" |
412 | # This module is already imported above, but just to make sure, since |
413 | # top imports may change over time. |
414 | - import ubuntu_sso.utils.ui # pylint: disable=W0612 |
415 | - with self.assertRaises(NameError): |
416 | - _ # pylint: disable=W0104,E0602 |
417 | + import ubuntu_sso.utils.ui |
418 | + assert(ubuntu_sso.utils.ui) |
419 | + self.assertFalse('_' in __builtins__) |
420 | |
421 | |
422 | class GetPasswordStrengTestCase(TestCase): |
423 | |
424 | === modified file 'ubuntu_sso/utils/webclient/__init__.py' |
425 | --- ubuntu_sso/utils/webclient/__init__.py 2012-04-09 17:38:24 +0000 |
426 | +++ ubuntu_sso/utils/webclient/__init__.py 2012-10-24 17:16:22 +0000 |
427 | @@ -30,13 +30,6 @@ |
428 | |
429 | import sys |
430 | |
431 | -# pylint: disable=W0611 |
432 | -from ubuntu_sso.utils.webclient.common import ( |
433 | - ProxyUnauthorizedError, |
434 | - UnauthorizedError, |
435 | - WebClientError, |
436 | -) |
437 | - |
438 | |
439 | def is_qt4reactor_installed(): |
440 | """Check if the qt4reactor is installed.""" |
441 | @@ -62,11 +55,12 @@ |
442 | def webclient_module(): |
443 | """Choose the module of the web client.""" |
444 | if is_qt4reactor_installed(): |
445 | - from ubuntu_sso.utils.webclient import qtnetwork as web_module |
446 | + from ubuntu_sso.utils.webclient import qtnetwork |
447 | + return qtnetwork |
448 | else: |
449 | - from ubuntu_sso.utils.webclient import libsoup as web_module |
450 | + from ubuntu_sso.utils.webclient import libsoup |
451 | #from ubuntu_sso.utils.webclient import txweb as web_module |
452 | - return web_module |
453 | + return libsoup |
454 | |
455 | |
456 | def webclient_factory(*args, **kwargs): |
457 | |
458 | === modified file 'ubuntu_sso/utils/webclient/tests/test_webclient.py' |
459 | --- ubuntu_sso/utils/webclient/tests/test_webclient.py 2012-06-29 20:57:01 +0000 |
460 | +++ ubuntu_sso/utils/webclient/tests/test_webclient.py 2012-10-24 17:16:22 +0000 |
461 | @@ -43,6 +43,7 @@ |
462 | from urlparse import urlparse, urljoin, parse_qsl |
463 | |
464 | from OpenSSL import crypto |
465 | +from oauth import oauth |
466 | from socket import gethostname |
467 | from twisted.cred import checkers, portal |
468 | from twisted.internet import defer |
469 | @@ -65,7 +66,13 @@ |
470 | from ubuntu_sso.utils import webclient |
471 | from ubuntu_sso.utils.ui import SSL_DETAILS_TEMPLATE |
472 | from ubuntu_sso.utils.webclient import gsettings, txweb |
473 | -from ubuntu_sso.utils.webclient.common import BaseWebClient, HeaderDict, oauth |
474 | +from ubuntu_sso.utils.webclient.common import ( |
475 | + BaseWebClient, |
476 | + HeaderDict, |
477 | + |
478 | + UnauthorizedError, |
479 | + WebClientError, |
480 | +) |
481 | |
482 | ANY_VALUE = object() |
483 | SAMPLE_KEY = "result" |
484 | @@ -314,7 +321,7 @@ |
485 | def test_get_iri_error(self): |
486 | """The errback is called when there's some error.""" |
487 | yield self.assertFailure(self.wc.request(self.base_iri + THROWERROR), |
488 | - webclient.WebClientError) |
489 | + WebClientError) |
490 | |
491 | @defer.inlineCallbacks |
492 | def test_zero_byte_in_content(self): |
493 | @@ -345,7 +352,7 @@ |
494 | def test_unauthorized(self): |
495 | """Detect when a request failed with the UNAUTHORIZED http code.""" |
496 | yield self.assertFailure(self.wc.request(self.base_iri + UNAUTHORIZED), |
497 | - webclient.UnauthorizedError) |
498 | + UnauthorizedError) |
499 | |
500 | @defer.inlineCallbacks |
501 | def test_method_head(self): |
502 | @@ -377,7 +384,7 @@ |
503 | password="wrong password!") |
504 | self.addCleanup(other_wc.shutdown) |
505 | yield self.assertFailure(other_wc.request(self.base_iri + GUARDED), |
506 | - webclient.UnauthorizedError) |
507 | + UnauthorizedError) |
508 | |
509 | @defer.inlineCallbacks |
510 | def test_request_is_oauth_signed(self): |
511 | @@ -418,7 +425,7 @@ |
512 | def test_webclienterror_not_string(self): |
513 | """The returned exception contains unicode data.""" |
514 | deferred = self.wc.request(self.base_iri + THROWERROR) |
515 | - failure = yield self.assertFailure(deferred, webclient.WebClientError) |
516 | + failure = yield self.assertFailure(deferred, WebClientError) |
517 | for error in failure.args: |
518 | self.assertTrue(isinstance(error, basestring)) |
519 | |
520 | @@ -508,6 +515,7 @@ |
521 | fake_reactor = FakeSavingReactor() |
522 | wc = txweb.WebClient(fake_reactor) |
523 | _response = yield wc.request(iri) |
524 | + assert(_response) |
525 | host, _port, _args = fake_reactor.connections[0] |
526 | self.assertEqual(host, self.FAKE_HOST) |
527 | |
528 | @@ -681,7 +689,7 @@ |
529 | |
530 | self.wc.force_use_proxy(partial_settings) |
531 | self.failUnlessFailure(self.wc.request(self.base_iri + SIMPLERESOURCE), |
532 | - webclient.WebClientError) |
533 | + WebClientError) |
534 | |
535 | if WEBCLIENT_MODULE_NAME.endswith(".txweb"): |
536 | reason = "txweb does not support proxies." |
537 | @@ -906,7 +914,7 @@ |
538 | self.spawn_return_code = Exception() |
539 | self.failUnlessFailure(self.wc.request_proxy_auth_credentials( |
540 | self.domain, True), |
541 | - webclient.WebClientError) |
542 | + WebClientError) |
543 | |
544 | @defer.inlineCallbacks |
545 | def test_creds_acquired(self): |
546 | @@ -922,7 +930,7 @@ |
547 | self.keyring.creds = Exception() |
548 | self.failUnlessFailure(self.wc.request_proxy_auth_credentials( |
549 | self.domain, self.retry), |
550 | - webclient.WebClientError) |
551 | + WebClientError) |
552 | |
553 | @defer.inlineCallbacks |
554 | def test_creds_none(self): |
555 | @@ -1071,7 +1079,7 @@ |
556 | # we fail due to the fake ssl cert |
557 | yield self.failUnlessFailure(self.wc.request( |
558 | self.base_iri + SIMPLERESOURCE), |
559 | - webclient.WebClientError) |
560 | + WebClientError) |
561 | # https requests do not use the auth proxy therefore called should be |
562 | # empty. This asserts that we are using the correct settings for the |
563 | # request. |
564 | @@ -1160,7 +1168,7 @@ |
565 | """Test showing the dialog and rejecting.""" |
566 | self.failUnlessFailure(self.wc.request( |
567 | self.base_iri + SIMPLERESOURCE), |
568 | - webclient.WebClientError) |
569 | + WebClientError) |
570 | self.assertNotEqual(None, self.memento.check_error('SSL errors')) |
571 | |
572 | def test_format_ssl_details(self): |
:)